实体框架7.0.0-beta3

时间:2015-02-25 14:14:07

标签: entity-framework

ASPNET Entity Framework 7.0.0-beta3的新版本已更改,我找不到OneToMany。 在之前的版本中,这可行。

#region Table setup
public DbSet<User> Users { get; set; }
public DbSet<Company> Companies { get; set; }
public DbSet<UserCompany> UserComanies { get; set; }
#endregion
#region Setup DbContext
/// <summary>
/// Build data model in here.
/// </summary>
/// <param name="builder">Builder.</param>
protected override void OnModelCreating(ModelBuilder builder) {
  builder.Entity<User>().OneToMany(c => c.UserCompanies, uc => uc.User).ForeignKey(uc => uc.UserId).Required(true);

}

有人知道在beta3中该做什么吗?

帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)