2つのプロジェクトがあります。最初のプロジェクトはdllプロジェクトで、2番目のプロジェクトはmvc4Webサイトです。dllには、DbContextを自動生成したエンティティデータモデルがあります。
Global.asaxで、次の行を使用してdbを初期化します。
System.Data.Entity.Database.SetInitializer( new DropCreateDatabaseAlways<WebConfigEntities>() );
サイトを開始すると、TypeLoadExceptionが発生します
Server Error in '/' Application.
GenericArguments[0], WebConfigDB.WebConfigEntities, voor System.Data.Entity.IDatabaseInitializer`1[TContext] is in strijd met de beperking van typeparameter TContext.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: GenericArguments[0], WebConfigDB.WebConfigEntities, voor System.Data.Entity.IDatabaseInitializer`1[TContext] is in strijd met de beperking van typeparameter TContext.
Source Error:
Line 46:
Line 47: BundleTable.Bundles.EnableDefaultBundles();
Line 48: }
Line 49: }
Line 50: }
Source File: D:\projecten\MD2400\WebConfig\Global.asax.cs Line: 48
Stack Trace:
[TypeLoadException: GenericArguments[0], WebConfigDB.WebConfigEntities, voor System.Data.Entity.IDatabaseInitializer`1[TContext] is in strijd met de beperking van typeparameter TContext.]
WebConfig.MvcApplication.Application_Start() in D:\projecten\MD2400\WebConfig\Global.asax.cs:48
どうすればこの問題を解決できますか?