I've run into a rather annoying issue when dealing with auto generated classes that's part of the domain model.
For example I'm consuming an OData endpoint which has entities that's part of my core domain model. I'm using the OData v4 Client Code Generator tool which is great but it outputs something like this:
public partial class FooBar :
global::Microsoft.OData.Client.BaseEntityType,
global::System.ComponentModel.INotifyPropertyChanged
{
...
That's tightly coupled to the Microsoft.OData.Client
which doesn't belong in the domain model.
One way to fix this would be to keep the auto-generated FooBar
class in a Microsoft.OData.Client
infrastructure project and create my own POCO of FooBar in the DomainModel
project and then use AutoMapper
to map between them. But that's so cumbersome :(
I much prefer the way Entity Framework does it via POCOs in the Code First approach. But I don't suppose that would be easy to implement elsewhere.
I'm at a loss here. I'd like to know what you've done when working with problems like this. Have I missed something obvious? Any (helpful) input really :)