我有一个由 Visual Studio 为我生成的数据库优先实体框架模型和上下文,当直接从测试项目中引用时它们很好。
但是,现在我试图通过 MEF 导出上下文和存储库并导入我的模块之一。但是,当我运行该应用程序时,出现以下错误
The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Resulting in: An exception occurred while trying to create an instance of type 'InsuranceManager.Data.Context.InsuranceDataContext'.
Resulting in: Cannot activate part 'InsuranceManager.Data.Context.InsuranceDataContext'.
Element: InsuranceManager.Data.Context.InsuranceDataContext --> InsuranceManager.Data.Context.InsuranceDataContext --> AssemblyCatalog (Assembly="InsuranceManager.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot get export 'InsuranceManager.Data.Context.InsuranceDataContext (ContractName="InsuranceManager.Data.Context.InsuranceDataContext")' from part 'InsuranceManager.Data.Context.InsuranceDataContext'.
Element: InsuranceManager.Data.Context.InsuranceDataContext (ContractName="InsuranceManager.Data.Context.InsuranceDataContext") --> InsuranceManager.Data.Context.InsuranceDataContext --> AssemblyCatalog (Assembly="InsuranceManager.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot set import 'InsuranceManager.Data.Repository.InsuranceRepository..ctor (Parameter="context", ContractName="InsuranceManager.Data.Context.InsuranceDataContext")' on part 'InsuranceManager.Data.Repository.InsuranceRepository'.
Element: InsuranceManager.Data.Repository.InsuranceRepository..ctor (Parameter="context", ContractName="InsuranceManager.Data.Context.InsuranceDataContext") --> InsuranceManager.Data.Repository.InsuranceRepository --> AssemblyCatalog (Assembly="InsuranceManager.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot get export 'InsuranceManager.Data.Repository.InsuranceRepository (ContractName="InsuranceManager.Data.Interface.IDataRepository")' from part 'InsuranceManager.Data.Repository.InsuranceRepository'.
Element: InsuranceManager.Data.Repository.InsuranceRepository (ContractName="InsuranceManager.Data.Interface.IDataRepository") --> InsuranceManager.Data.Repository.InsuranceRepository --> AssemblyCatalog (Assembly="InsuranceManager.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot set import 'InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel..ctor (Parameter="repository", ContractName="InsuranceManager.Data.Interface.IDataRepository")' on part 'InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel'.
Element: InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel..ctor (Parameter="repository", ContractName="InsuranceManager.Data.Interface.IDataRepository") --> InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel --> AssemblyCatalog (Assembly="InsuranceManager.GUI.MaintenanceModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot get export 'InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel (ContractName="InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel")' from part 'InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel'.
Element: InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel (ContractName="InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel") --> InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel --> AssemblyCatalog (Assembly="InsuranceManager.GUI.MaintenanceModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot set import 'InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView.ViewModel (ContractName="InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel")' on part 'InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView'.
Element: InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView.ViewModel (ContractName="InsuranceManager.GUI.MaintenanceModule.ViewModel.GeoRegionMaintenanceViewModel") --> InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView --> AssemblyCatalog (Assembly="InsuranceManager.GUI.MaintenanceModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
Resulting in: Cannot get export 'InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView (ContractName="System.Object")' from part 'InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView'.
Element: InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView (ContractName="System.Object") --> InsuranceManager.GUI.MaintenanceModule.View.GeoRegionMaintenanceView --> AssemblyCatalog (Assembly="InsuranceManager.GUI.MaintenanceModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")
谁能帮助我了解这可能意味着什么以及从哪里开始寻找?