3
我需要建立一個DAL的設計有多種模式,這是造成我一些問題的數據庫:如何配置我的DbSet以映射到特定SqlServer架構中的特定表?
因此,舉例來說,考慮在兩個獨立的模式,這些表(供應商,交易)
- Suppliers.Suppliers
- Suppliers.Types
- Deals.Deals
- Deals.Types
我在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文件。