2011-02-03 64 views
0

我有一个实体有2个引用到同一个表。当我做一个实例,实体框架自动实例2实体的第二个表具有相同的名称+1或2.我想以编程方式更改2个自动实例的名称,这是可能的?我不想改变模型,因为在将来,也许我将不得不重新生成模型,并且对此进行的更改将会丢失。1个具有2个对同一个表的引用的实体。更改实体名称?

对不起,我的英文不好

Example: 

SQL Tables: 

    **Table People** 
    ID_People 
    Name 
    Address 

    **Table XXX** 
    ID_Customer (FK to People) 
    ID_Seller (FK to People) 

Automatic Entities: 

    **Entity for Table XXX** 
    ID_Customer (FK to People) 
    ID_Seller (FK to People) 
    People1 
    People2 

I Want : 

    **Entity for Table XXX** 
    ID_Customer (FK to People) 
    ID_Seller (FK to People) 
    Customer (Instance of people for ID_Customer) 
    Seller (Instance of people for ID_Seller) 

回答

0

不应该改变模型。您无法动态更改导航属性的名称。此外,如果您在设计器(EDMX - CSDL)中更改名称,则从数据库更新后,这些更改不会丢失。

+0

是的,但如果我删除表,然后重新插入,更改将丢失:(以任何方式 – 2011-02-03 18:48:57

相关问题