問題描述:app
The type DbConnection cannot be constructed. You must configure the container to supply this value.函數
用戶代碼未處理 Microsoft.Practices.Unity.ResolutionFailedExceptionthis
HResult=-2146233088spa
Message=Resolution of the dependency failed, type = "UIShell.OneCardService.IMembershipCardRepository", name = "(none)".ip
Exception occurred while: while resolving.it
Exception is: InvalidOperationException - The type DbConnection cannot be constructed. You must configure the container to supply this value.io
-----------------------------------------------ast
At the time of the exception, the container was:exception
Resolving UIShell.OneCardService.MembershipCardRepository,(none) (mapped from UIShell.OneCardService.IMembershipCardRepository, (none))model
Resolving parameter "context" of constructor UIShell.OneCardService.MembershipCardRepository(LCL.Repositories.IRepositoryContext context)
Resolving LCL.Repositories.EntityFramework.EntityFrameworkRepositoryContext,(none) (mapped from LCL.Repositories.IRepositoryContext, (none))
Resolving parameter "efContext" of constructor LCL.Repositories.EntityFramework.EntityFrameworkRepositoryContext(System.Data.Entity.DbContext efContext)
Resolving System.Data.Entity.DbContext,(none)
Resolving parameter "existingConnection" of constructor System.Data.Entity.DbContext(System.Data.Common.DbConnection existingConnection, System.Data.Entity.Infrastructure.DbCompiledModel model, System.Boolean contextOwnsConnection)
Resolving System.Data.Common.DbConnection,(none)
解決辦法:
把 efContext 加入進去就能夠了,構造函數參數錯誤。