I have a separate domain model and data model in my application, domain model is focus on business logic and data model is presented for repository.
I want to map the data model to the domain model, is it a good way to let the domain model contain a data model, such as
class DataModel
{
public int ID { get; set; }
}
class DomainModel
{
private DataModel dataModel;
public int ID
{
get { return dataModel.ID; }
set { dataModel.ID = value; }
}
// other operations
}
and there is other good pattern to map the data model to the domain model.
Thanks!
Usually I design an interface in the domain model, and apply it to my objects in the data model.