Reputation: 111
I have two questions.
1: At the moment I have two model classes that are mapped to two entities in the EF diagram.
How does DDD work with EF because if I decide to split my model classes into smaller specific classes e.g. from 2 to 4. How will EF relate to them?
Will I have to create a seperate DTO to map these four model classes to the two entity models that EF will understand?
Just wondering how other people have managed to get around this issue.
2: EF only recognises models that have public properties. If I change my model class to have behavioural methods like GetName(), SetName(), GetAddress() etc and remove the public properties to be private members then EF throws a wobbly and complains it can not find any properties on my model. How do I solve this issue? Or would the answer be the same as the first question in that I need to create a DTO that has public properties which map from my model class which EF will use?
I'm just thinking if this is the correct path to take because it seems like a bit of redundant work having to map my DDD model classes to another set of DTO or EF model classes that EF understand. If I do have to map to the EF classes will they be in the model layer or repository layer?
Upvotes: 0
Views: 220
Reputation: 364279
Upvotes: 1