문제

I'm doing a DB-First generation of a DbContext and POCO objects with EF6 and having the same issues as many others re the navigation property names being unhelpful in describing relationships to other tables.

e.g If a Person has a Home and Work address, it would be reflected in the object as

public class Person {
    public virtual DbSet<Address> Address; 
    public virtual DbSet<Address> Address1;
}

This question is on the right track for EF5, however neither the tool nor the code solution supports the t4 template generated by EF6. Improve navigation property names when reverse engineering a database

What's the easiest way I can replace the above with

public class Person {
    public virtual DbSet<Address> Home; 
    public virtual DbSet<Address> Work;
}

AND be able to regenerate the edmx file when I need to from scratch (i.e manually modifying 100 tables via the vs2013 GUI is not what I'm looking for).

I've looked around the forums and have started using the debug T4 Template tool but hoping there is a easier out than DIY.

도움이 되었습니까?

해결책

If you don't need edmx, then you can remove it at all and reverse your database into Code First using EF Power Tools. After that use any tool that will help with property renames e.g Resharper

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top