Reputation: 1187
In my project, I want to have access to 2 different databases. I created two .edmx files in the same project, added the self tracking entities T4 thingie, and kaboom :) Does not work anymore.
I get a looooooot of ambiguity errors (ObjectChangeTracker and such)
What would be the preferred solution here? I can delete the duplicate content in the generated files but when modifying the .edmx file it just regenerates of course... Any thoughts?
Upvotes: 3
Views: 722
Reputation: 132658
Providing none of your database objects are named the same, you can comment out part of the T4 template which creates generic objects for one copy of your edmx file.
WriteHeader(fileManager);
BeginNamespace(namespaceName, code);
/* Comment out this part
WriteObjectChangeTracker();
WriteIObjectWithChangeTracker();
WriteCustomObservableCollection();
WriteINotifyComplexPropertyChanging();
WriteEqualityComparer();
*/
EndNamespace(namespaceName);
If you do have database objects named the same, I'd recommend putting each edmx file in a separate namespace.
Upvotes: 1