一部のエンティティに対して DB に特定のスキーマを作成したい。"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) を見ました。「ACL」スキーマで SystemKeyRole(junction table) を強制的に生成するにはどうすればよいですか?