我需要为其构建 DAL 的数据库设计有多个模式,这给我带来了一些问题:
因此,例如,在两个单独的模式(供应商、交易)中考虑这些表
- 供应商.供应商
- 供应商类型
- 特卖。特卖
- 交易类型
我有 C#
namespace Data.Entities.Suppliers
{
public class Suppliers { /* properties mapped to fields in Sql Server table Suppliers .Suppliers */ }
public class Types { /* properties mapped to fields in Sql Server table Suppliers .Types */ }
}
namespace Data.Entities.Deals
{
public class Deals { /* properties mapped to fields in Sql Server table Deals.Deals */ }
public class Types { /* properties mapped to fields in Sql Server table Deals.Types */ }
}
namespace Data.Repositories
{
public class EfDataContext: DbContext
{
public DbSet<Suppliers.Suppliers> Suppliers { get; set; }
public DbSet<Suppliers.Types> SupplierTypes { get; set; }
public DbSet<Deals.Deals> Deals{ get; set; }
public DbSet<Deals.Types> DealTypes { get; set; }
}
}
但是 EF 绊倒了两个名为“类型”的东西,我如何仅使用 DbSet 来消除两者的歧义?
注意:我试图摆脱拥有 .edmx 文件。