[ForeignKey("Creator")]
public string CreatorID {get;set;}
public virtual ApplicationUser Creator {get;set;}
I have a model which I want to save the creator and modifier. But there are errors during migration
我有一个模型,我想保存创建者和修饰符。但是迁移期间存在错误
TSRDTEST.Models.IdentityUserLogin: : EntityType 'IdentityUserLogin' has no key defined. Define the key for this EntityType.
TSRDTEST.Models.IdentityUserRole: : EntityType 'IdentityUserRole' has no key defined. Define the key for this EntityType.
IdentityUserLogins: EntityType: EntitySet 'IdentityUserLogins' is based on type 'IdentityUserLogin' that has no keys defined.
IdentityUserRoles: EntityType: EntitySet 'IdentityUserRoles' is based on type 'IdentityUserRole' that has no keys defined.
I'm using built in login/logout/register template,with database column prefixs "AspNet", is there any way to fix that error without modify entire project project and preserve the columns with prefix AspNet, Thanks
我正在使用内置的登录/注销/注册模板,数据库列前缀为“AspNet”,有没有办法修复该错误而无需修改整个项目项目并保留带有前缀AspNet的列,谢谢
1 个解决方案
#1
1
Actually I didnt understand what you want to do. But the mapping between entities should be look like this.
其实我不明白你想做什么。但实体之间的映射应该是这样的。
public string CreatorID {get;set;}
[ForeignKey("CreatorID ")]
public virtual ApplicationUser Creator {get;set;}
#1
1
Actually I didnt understand what you want to do. But the mapping between entities should be look like this.
其实我不明白你想做什么。但实体之间的映射应该是这样的。
public string CreatorID {get;set;}
[ForeignKey("CreatorID ")]
public virtual ApplicationUser Creator {get;set;}