为什么 SqlMetal 弄乱了关联名称。例如,在我的“TextMessage”表中,我有两列引用“ApplicationUser”表。'SenderUserId' 和 'RecipientUserId'
当我运行 SqlMetal 并查看我的“ApplicationUser”类时
对于“RecipientUserId”,它会生成:
[Association(Name="FK__TextMessa__Recip__72910220", Storage="_TextMessages", ThisKey="Id", OtherKey="RecipientUserId", DeleteRule="NO ACTION")]
public EntitySet<TextMessage> TextMessages
{
get
{
return this._TextMessages;
}
set
{
this._TextMessages.Assign(value);
}
}
对于“SenderUserId”,它会生成这个名为垃圾的属性:
[Association(Name="FK__TextMessa__Sende__73852659", Storage="__TextMessa__Sende__73852659s", ThisKey="Id", OtherKey="SenderUserId", DeleteRule="NO ACTION")]
public EntitySet<TextMessage> _TextMessa__Sende__73852659s
{
get
{
return this.@__TextMessa__Sende__73852659s;
}
set
{
this.@__TextMessa__Sende__73852659s.Assign(value);
}
}
我该如何补救?这是不可用的。有没有更好的方法来生成 Linq To Sql 代码???