I really like the concept of keeping a pristine domain model where you don't need to reference any 3rd party DLLs. I'd like to be able to design a domain model where you could use a fluent API from entity framework or mongodb to define your mappings outside of the domain assembly. I'd also like to be able to use Guids for Entity Framework and ObjectIds for MongoDB when it comes to entity IDs.
The problem is this, none of these four datatypes are ideal:
public Guid Id { get; set; } // can't use ObjectIds for mongo
public ObjectId Id { get; set; } // not compatible with entity framework
public object { get; set; } // not compatible with entity framework
public string { get; set; } // EF has problems wiring this up to a Guid column
Does anyone know a clean way of defining some pristine POCOs that can use Guids in EF and ObjectIds in MongoDB? I'd like to be able to swap between the two persistence technologies without having to make changes to my domain model.
If I can have something generic in my POCO and define the data type in each FluentAPI that would be perfect but that has also proved challenging.