zoukankan      html  css  js  c++  java
  • IOC错误

    问题描述:

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

  • 相关阅读:
    解析ASP.NET Mvc开发之删除修改数据
    JavaScript module pattern精髓
    Remote验证及其改进(附源码)
    图模型的精确推理
    C#在泛型类中,通过表达式树构造lambda表达式
    类管理指针成员
    朴素贝页斯分类法
    使用Repository模式构建数据库访问层
    利用MVC的过滤器实现url的参数加密和解密
    在多线程中使用静态方法是否有线程安全问题
  • 原文地址:https://www.cnblogs.com/luomingui/p/5832524.html
Copyright © 2011-2022 走看看