I have 3 tables in my MS SQL database and I have added a EntityFramework(latest) to my project where I have imported these 3 tables. The first problem was that no Entities w
You should either use None
code generation strategy for your .edmx file. Or remove MainModel.tt
and MainModel.Context.tt
templates, which generate model entities and context.
If you use Default
code generation strategy, then entities and context will be generated into MainModel.Designer.cs
file. That would be standard entities, inherited from EntityObject
, context will be inherited of ObjectContext
. With Entity Framework 5 we have POCO entities generation. And whole generation is done in T4 templates, which generate context, inherited from DbContext
, and POCO entities without some base type (well, object only).
When you have both templates and enabled code generation in edmx designer, then two sets of entities will be generated. That's why you have names conflict.