我正在尝试使用 BulkInsert
在 C# 中的 EF6 中。
我有一个扩展列表 DataModel
.我将转换回数据库的类型。
List<pc_d_zeiten> ImportZeitenListe = pc_d_zeiten_extendend.ConvertExtendedModelBack((from item in zeitenListe where item.DoInsert == true select item).ToList());
调用插入:
public void InsertZeitenModelListe(List<pc_d_zeiten> zeitenListe)
{
db.BulkInsert(zeitenListe);
db.SaveChanges();
}
当我调用 dbContext.BulkInsert(List<entity>)
正在触发异常:
Type 'PROCESSPC_Core.PZE.Model.pc_d_zeiten_extendend' is not found in context 'PROCESSPC_Core.DAL.ProcessPCEntities'
我确实更新了 MappingApi,重建了我的项目。但它不起作用。
最佳答案
这意味着该类型在每个层次结构的表中未被识别为任何类型的实体或实体子类。
如果您在上下文中有一个标记为 DbSet 的类型……该类型可以从任意多个类继承。但是,该类的子类必须注册为可区分类型。如果您有一些派生自未注册为可区分类型的 DbSet 类型的共享类,则不会找到它。
关于c# - 在 Entity Framework 6 中的 BulkInsert 期间在上下文中找不到类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33734182/