Hello, I am very interested in your Effort library and have been working to integrate it into our system. I was previously using a "hacked up" system involving HashSets to accomplish this.
A problem I've had is that all our mock objects are defined using entities and Id values, such as:
var mockClient = new Client { Id = 1001, Name = "Test Client" };
var mockProduct = new Product { Id = 2001, ClientId = 1001, Name = "Test Product" };
The problem with this approach is that there are CSV and database "loaders", but no "entity loader". I tried writing a loader for these entities (I submitted a pull request with some exception handling that helped me in this case) but
found it to be cumbersome doing so many type conversions.
So then I tried simply "adding" these entities to the DbSet and calling SaveChanges() in my [TestInitialize] method. The problem however is that Effort/NMemory will change the Id values when they are saved, and so now mockProduct points to a missing
ClientId.
What is your recommended approach in this scenario? Should I go back to trying to finish the "entity loader"? Or is there a way I can get NMemory to perform an "Identity insert" and leave the Id values alone?
Many thanks for your time & suggestions.
|