Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/328.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否有方法必须在同一程序集中对具有相同类型名称的第一个实体进行EF编码?_C#_Entity Framework_Ef Code First - Fatal编程技术网

C# 是否有方法必须在同一程序集中对具有相同类型名称的第一个实体进行EF编码?

C# 是否有方法必须在同一程序集中对具有相同类型名称的第一个实体进行EF编码?,c#,entity-framework,ef-code-first,C#,Entity Framework,Ef Code First,我当前在EF代码优先上下文中遇到以下错误: Unhandled Exception: System.Data.MetadataException: Schema specified is not valid. Errors: The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Offer'. Previously found CLR type 'CakeEx

我当前在EF代码优先上下文中遇到以下错误:

Unhandled Exception: System.Data.MetadataException: Schema specified is not valid. Errors:
The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'Offer'. Previously found CLR type 'CakeExtracter.CakeMarketingApi.Entities.Offer', newly found CLR type 'Cake
Extracter.Data.CakeTraffic.Offer'.
   at System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection
, Action`1 logLoadMessage)
   at System.Data.Metadata.Edm.MetadataWorkspace.LoadFromAssembly(Assembly assembly, Action`1 logLoadMessage)
   at System.Data.Entity.Infrastructure.DbCompiledModel.CreateObjectContext[TContext](DbConnection existingConnection)
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)

除了创建一个单独的项目以使这两个上下文位于不同的程序集中之外,还有什么方法可以解决此问题吗?

此问题的答案是安装EF6,在其中解决此问题

我使用了PMC命令:
Install-Package-EntityFramework-Pre


然后我不得不对我的代码进行调整,因为
EntityState
枚举移到了
System.Data
命名空间中,然后它工作得很好。

我相信我找到了一个EF6的工作项,试图确定它是否描述了我的问题