Reputation: 676
Reading this blog post about Primitive Obsession I was wondering:
How can I create a strongly-typed entity using Entity Framework Code First? (specially regarding mapping these strong types to primitive types in SqlServer)
Does that make sense? (I've never found any examples/tutorials on the web with this kind of approach)
Suppose we have an Address entity/class with a strongly-typed Zipcode property as we can see here.
Upvotes: 1
Views: 591
Reputation: 364249
Edited version according to comment:
It make sense but you have never found any example because it is not directly possible with EF code first. Why?
As a workaround you can use private setter and both default constructor (maybe it doesn't have to be public but I didn't try this) and constructor with parameters and correctly map property (at least with EDMX it works).
Upvotes: 3