码迷,mamicode.com
首页 > 其他好文 > 详细

IOC错误

时间:2016-09-02 11:30:38      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:

问题描述:

 

The type DbConnection cannot be constructed. You must configure the container to supply this value.

 

用户代码未处理 Microsoft.Practices.Unity.ResolutionFailedException

  HResult=-2146233088

  Message=Resolution of the dependency failed, type = "UIShell.OneCardService.IMembershipCardRepository", name = "(none)".

Exception occurred while: while resolving.

Exception is: InvalidOperationException - The type DbConnection cannot be constructed. You must configure the container to supply this value.

-----------------------------------------------

At the time of the exception, the container was:

 

  Resolving UIShell.OneCardService.MembershipCardRepository,(none) (mapped from UIShell.OneCardService.IMembershipCardRepository, (none))

  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 加入进去就可以了,构造函数参数错误。

IOC错误

标签:

原文地址:http://www.cnblogs.com/luomingui/p/5832524.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!