Do you keep your domain layer independent of the data access concerns?
Updated by Brady Stroud [SSW] 1 year ago. See history
❌ Figure: 
As you can see in the above example, the domain is cluttered with data annotations. If the data access technology changes, we will likely need to change all entities as all entities will have data annotations. In the following example, we will remove the data annotations from the entity and instead use a special configuration type:
✅ Figure: 
This is a big improvement! Now the customer entity is lean, and the configuration can be added to the persistence layer, completely separate of the domain. Now the domain is independent of data access concerns.
Learn more about this approach by reading about self-contained configuration for code first.

Figure: Database implementation is a Infrastructure concern not a Domain concern
Categories
Need help?
SSW Consulting has over 30 years of experience developing awesome software solutions.