I can't believe I didn't find good article about it. So it might be a 1000 times asked question.
I'm writing a sample, which consists of Nancy MVC, plus Service Layer, Core Layer, DAL. Where DAL use MongoDB. What I'm trying to achieve is to separate MongoDB from Core. In any example I'm reading about mongoDB I'm seeing something like follows:
public class Customer
{
public ObjectId Id{get;set;}
public string Name { get; set; }
public string Address { get; set; }
IEnumerable<string> Telephones { get; set; }
[BsonElement("PublicWebPage")]
public WebPage PublicPage { get; set; }
}
Which from my understanding is not so good, as I need to install MongoDB Driver into my Core. On the other hand I can try put this models to DAL and Write almost the same one in Core, and with help of some mapper map one to another, that means that it will be two duplicated objects.
What I'm trying to find is the approach that may be will copy EF Fluent API approach, or any different one, that can help me to keep my models clean.