问题描述:

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错误的更多相关文章

  1. 航空概论(历年资料,引之百度文库,PS:未调格式,有点乱)

    航空航天尔雅 选择题1. 已经实现了<天方夜谭>中的飞毯设想.—— A——美国2. 地球到月球大约—— C 38 万公里3. 建立了航空史上第一条定期空中路线—— B——德国4. 对于孔明 ...

  2. 【初探Spring】------Spring IOC(一)

    IOC:Inversion of Control(控制反转).IOC它所体现的并不是一种技术,而是一种思想,一种将设计好的对象交给容器来管理的思想.IOC的核心思想就体现在控制.反转这两个词上面,要理 ...

  3. .NET里简易实现IoC

    .NET里简易实现IoC 前言 在前面的篇幅中对依赖倒置原则和IoC框架的使用只是做了个简单的介绍,并没有很详细的去演示,可能有的朋友还是区分不了依赖倒置.依赖注入.控制反转这几个名词,或许知道的也只 ...

  4. Autofac 的属性注入,IOC的坑

    Autofac 是一款优秀的IOC的开源工具,完美的适配.Net特性,但是有时候我们想通过属性注入的方式来获取我们注入的对象,对不起,有时候你还真是获取不到,这因为什么呢? 1.你对Autofac 不 ...

  5. IL实现简单的IOC容器

    既然了解了IL的接口和动态类之间的知识,何不使用进来项目实验一下呢?而第一反应就是想到了平时经常说的IOC容器,在园子里搜索了一下也有这类型的文章http://www.cnblogs.com/kkll ...

  6. Spring的IOC和AOP之深剖

    今天,既然讲到了Spring 的IOC和AOP,我们就必须要知道 Spring主要是两件事: 1.开发Bean:2.配置Bean.对于Spring框架来说,它要做的,就是根据配置文件来创建bean实例 ...

  7. 通过中看不中用的代码分析Ioc容器,依赖注入....

    /** * 通过生产拥有超能力的超人实例 来理解IOC容器 */ //超能力模组接口 interface SuperModuleInterface{ public function activate( ...

  8. Unity 处理IOC AOP

    用Unity 可以做IOC(控制反转) AOP(切面)可以做统一的异常和日志处理,非常方便,项目中是用微软企业库中的Microsoft.Practices.Unity实现 1 定义接口与实现 //定义 ...

  9. [spring源码学习]十、IOC源码-conversionService

    一.代码示例 1.我们在之前的Person类里新增一个两个属性,分别是客户的兴趣和生日,兴趣爱好有很多,我们使用list进行保存,生日使用日期进行保存 public class Person { pr ...

随机推荐

  1. 【细说Java】path和classpath的作用

    path:javac.exe和java.exe等可执行文件存放路径,通过path变量让系统寻找该路径的可执行文件,然后对Java代码进行编译和运行. ps:如果有多个jdk版本的赋给path变量,系统 ...

  2. 『TCP/IP详解——卷一:协议』读书笔记——03

    2013-08-17 17:31:49 1.7 分用 分用(Demultiplexing):这是一个过程——当目的主机收到一个以太网数据帧时,数据就开始从协议栈中由底向上升,同时去掉各层协议上的报文首 ...

  3. 【08_238】Product of Array Except Self

    Product of Array Except Self Total Accepted: 26470 Total Submissions: 66930 Difficulty: Medium Given ...

  4. oracle decode(nvl(estimate_qty,0),0,1,estimate_qty) 函數

    oracle   decode(nvl(estimate_qty,0),0,1,estimate_qty) 函數

  5. “SSLError: The read operation timed out” when using pip

    Downloading/unpacking Django>=1.5.1,<1.6 (from -r requirements.txt (line 1)) Downloading Djang ...

  6. C#之玩转反射

    前言 之所以要写这篇关于C#反射的随笔,起因有两个:   第一个是自己开发的网站需要用到   其次就是没看到这方面比较好的文章. 所以下定决心自己写一篇,废话不多说开始进入正题. 前期准备 在VS20 ...

  7. 解决IIS Express 80端口被占用的情况

    VS2012运行站点的时候提示“无法启动IIS Express Web服务器,端口80正在使用” 于是CMD查看了一下端口使用情况,并且在任务管理器中查看相应的进程,但始终觉得不对,因为显示是Syst ...

  8. Windows下使用Redis(一)安装使用

    一.Redis 是什么 Redis 是一款依据BSD开源协议发行的高性能Key-Value存储系统(cache and store).它通常被称为数据结构服务器,因为值(value)可以是 字符串(S ...

  9. EntityFramework 4/5/6 中执行自定义SQL语句

    参考:http://www.cnblogs.com/chengxiaohui/articles/2092001.html 在EF4(.NET  4)中,我们有了全新的API:ObjectContext ...

  10. iOS开发——高级技术&内购服务

    内购服务 大家都知道做iOS开发本身的收入有三种来源:出售应用.内购和广告.国内用户通常很少直接 购买应用,因此对于开发者而言(特别是个人开发者),内购和广告收入就成了主要的收入来源.内购营销模式,通 ...