I'm trying to model my domain model using the entity framework. An example is Page class containing a Content class.
public class Page
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual Content PageContent { get; set; }
}
public class Content
{
public IList<Version> Versions { get; private set; }
public Version GetLatestPublishedVersion()
{
//Some biz logic to get the latest published version
}
public Version GetLatestDraftVersion()
{
//Some biz logic to get the latest draft version
}
public void AddVersion() {}
public void DeleteVersion() {}
....
}
The database model does not have a table for Content, in fact the table relationship is:
Pages Table
----------
Id
Name
Versions Table
--------------
Id
PageId FK PAGES.ID
Title
Body
How can i model the Content class in the conceptual model? I tried using a complex type, but it only hold scalar properties. Tried using an Entity type but i get a message which basically says set up a table in the database for the Content class, why?
I dont feel that the Domain Model is wrong, it was designed like this so the publishing concerns are not on the Page class. Typical encapsulation at work here.
Has anyone else bumped into this problem?