我想在数据库中为某些实体创建一个特定的模式。“Role”和“SystemKey”具有多对多关系,并且两个主题都在“ACL”模式中。
public class Role
{
public long Id { get; set; }
public string Title { get; set; }
//Navigation prop
public virtual ICollection<SystemKey> SystemKeys { get; set; }
}
和
public class SystemKey
{
public SystemKey()
{
Roles = new HashSet<Role>();
}
public long Id { get; set; }
public string ActionName { get; set; }
public string ControllerName { get; set; }
//Navigation prop
public ICollection<Role> Roles { get; set; }
}
在“OnModelCreating”中我定义:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Role>().ToTable("Role", "ACL");
modelBuilder.Entity<SystemKey>().ToTable("SystemKey", "ACL");
}
}
但是,当 DB 生成时,我看到在 ACL 模式中生成的角色和系统密钥以及在 dbo 模式中创建的联结表(SystemKeyRole)。我如何强制 SystemKeyRole(junction table) 在“ACL”模式中生成?