Reputation: 5552
I have the following tables in my database:
Business.Profiles
User.Profiles
where 'Business' and 'User' are schema.
When generating the DbContext via Ado.Net DbContext Generator(Add code generation item) I get two classes in code:
Profile
Profile1
Ideally I would have liked the the Schema names get converted to clr namespaces but that did not happen. Is there some way of forcing something like this? How do I deal with this?
Upvotes: 1
Views: 294
Reputation: 364269
DbContext Generator only uses names specified in EDMX file so I guess you have Profile
and Profile1
entity defined in EDMX.
Classes must have exactly the same name as entities in EDMX and you cannot map two classes with the same name to the same EDMX model. EF doesn't support it because POCO classes are mapped by convention which uses just the name of class (EF don't use CLR namespace in mapping). Because of that you cannot achieve what you want. The simples workaround is simply naming your entities in EDMX UserProfile
and BusinessProfile
.
Upvotes: 2