Hello,
Now we migrated under VS 2012
(However, in the graphical EDMX-Designer the Key-Column is shown in the properties correctly.)
In the MyModel.edmx > MyModel.tt are all Entities are automatically defined by the EDMX-Designer, but without the „[Key]"-annotations! When I set the "[Key]"-annotations of each table by myself, the upper problem is solved, but everytime, I change my graphical Model, this files will be automatically overwritten by the EDMX-Designer.
1.) What I have to do, that the EMDX-Designer will generate automatically the code with the correct Key-annotations?
After this, there occurs a second problem, which is caused by the linq-commands too: „Unable to determine the principal end of an association between the types … and … The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.“
2.) So it seems, the relationships are not created by the EDMX-Designer too.? What I have to do, that the EDMX-Designer will generate automatically the code with the correct annotations?
Maybe there is a bug in the EDMX-Designer? (At ObjectContext the EDMX-Designer created all these things automatically.)
3.) (OnModelCreating was created automatically, but filled with "throw new UnintentionalCodeFirstException();" - So I only removed this line. But what I have to write inside instead?
Thank you very much!
Best regards!
Now we migrated under VS 2012
-
from: EF 5 (with ObjectContext, Database first, EDMX-Designer)
-
to: EF 6.1.0 (with DBContext, Database first, EDMX-Designer). We installed the "Entity Framework 6.0.2 Tools for Visual Studio 2012" and we are still using the graphical EDMX-Designer but have the following problem:
(However, in the graphical EDMX-Designer the Key-Column is shown in the properties correctly.)
In the MyModel.edmx > MyModel.tt are all Entities are automatically defined by the EDMX-Designer, but without the „[Key]"-annotations! When I set the "[Key]"-annotations of each table by myself, the upper problem is solved, but everytime, I change my graphical Model, this files will be automatically overwritten by the EDMX-Designer.
1.) What I have to do, that the EMDX-Designer will generate automatically the code with the correct Key-annotations?
After this, there occurs a second problem, which is caused by the linq-commands too: „Unable to determine the principal end of an association between the types … and … The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.“
2.) So it seems, the relationships are not created by the EDMX-Designer too.? What I have to do, that the EDMX-Designer will generate automatically the code with the correct annotations?
Maybe there is a bug in the EDMX-Designer? (At ObjectContext the EDMX-Designer created all these things automatically.)
3.) (OnModelCreating was created automatically, but filled with "throw new UnintentionalCodeFirstException();" - So I only removed this line. But what I have to write inside instead?
Thank you very much!
Best regards!