Skip to content

Would you (or do you) use Option to model nullable database columns? #1102

Answered by YuriiNskyi
Meigs2 asked this question in Q&A
Discussion options

You must be logged in to vote

I feel like nullable reference types are more fitting on the raw data model, given nullable reference types in C# seem like they would more directly reflect null data on the database-side rather than Option.

You have answered the question by yourself. EF Core and other ORM`s are intended to work with raw C# features, so there is no point trying to tie EF Core and high-level functional (unknown for him) things.

In other words, let the Option be inside your Domain, while nullable reference types remain inside Infrastructure (ORMs and so forth). Don't mix them (use Option inside Infrastructure and vice versa), it is a guaranteed way for a lot of mistakes.

So, how to connect your Domain and I…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Meigs2
Comment options

Answer selected by Meigs2
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants