从网上下载的源码WeCompanySite,运行时报错

Error creating context 'spring.root': Error thrown by a dependency of object 'System.Data.SQLite' defined in 'assembly [Spring.Data, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07], resource [Spring.Data.Common.dbproviders.xml] line 1386' : Unsatisfied dependency expressed through constructor argument with index 2 of type [System.Type] : Could not convert constructor argument value [System.Data.SQLite.SQLiteConnection, System.Data.SQLite, Version=1.0.65.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139] to required type [System.Type] : Cannot convert property value of type [System.String] to required type [System.Type] for property ''.
while resolving 'constructor argument with name dbmetadata' to 'Spring.Data.Common.DbMetadata#7A6D1C' defined in 'assembly [Spring.Data, Version=1.3.1.40711, Culture=neutral, PublicKeyToken=65e474d141e25e07], resource [Spring.Data.Common.dbproviders.xml] line 1386'

在网上找到了这篇文章

http://blog.csdn.net/panderman/article/details/7295302

然后发现web.config中配置为

<!--SQLite-->
<add key="provider" value="System.Data.SQLite"/>
<add key="connectionString" value="Data Source=|DataDirectory|DataBase.db;Version=3;FailIfMissing=False;"/>
<add key="dialect" value="NHibernate.Dialect.SQLiteDialect"/>
<add key="driver_class" value="NHibernate.Driver.SQLite20Driver"/>

才恍然大悟,本机没有安装SQLite。

VS 2012默认是不带的SQLite的Data Provider,所以无法直接在VS 2012里管理SQLite的数据库,自然也不能在VS里像SQL Server那样直接生成Entity Framework的model类了。SQLite团队为了解决这个问题,在SQLite的安装包里把用于VS2012的Data Provider给打包进去了。但是撸主却失败了无数次才找到正确把SQLite整合到VS里的方法,记录如下,分享给有需要的童鞋。

  1. 首先从http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki下载SQLite安装包。这个页面安装包非常多,一下子就会看眼花缭乱。需要注意的是只有32位的安装包才会能把SQLite的Data Provider加到VS Designer里。如果你已经看的眼花缭乱,一个简单的方法就是搜索右边描述里有显示如下黑体语句的This is the only setup package that is capable of installing the design-time components for Visual Studio 2012的安装包,直接下载安装就行。撸主这次下载到的文件名是sqlite-netFx45-setup-bundle-x86-2012-1.0.93.0.exe。
  2. 安装的时候一定不要用Full Installation,要选择Custom Installation,然后只选择Core Component(包括它里面的2个) 以及Visual Studio Designer Component。
  3. 点击下一步,在Install Designer For Visual Studio 2012前面打钩

  4. 安装完毕后,重启VS 2012后就应该能看到SQLite Data Provider的选项了。

2014.8.10更新,Visual Studio 2013里启用SQLite Data Provider的步骤是一样的,就是下载安装包的时候要选择This is the only setup package that is capable of installing the design-time components for Visual Studio 2013左边的那个安装包。

启用SQLite的Data Provider 运行WECOMPANYSITE时遇到ERROR CREATING CONTEXT 'SPRING.ROOT': ERROR THROWN BY A DEPENDENCY OF OBJECT 'SYSTEM.DATA.SQLITE'的更多相关文章

  1. 配置好运行后Error creating context 'spring.root': Could not load type from string value

    在Webconfig文件的当前项目下引用相关项目

  2. System.Data.SQLite兼容32位和64位问题

    SQLite版本分的很详细,本机是64位在32位会出现问题,经过搜索找到解决方案. 这是我以前写的32位在我现在的机子上的运行报错. 类似这样的. 将当前说明文档的目录下的x64.x86目录和Syst ...

  3. 解决System.Data.SQLite兼容32位和64位问题

    将当前说明文档的目录下的x64.x86目录和System.Data.SQLite.dll文件复制到您的应用程序根目录中(注意更新引用,引用System.Data.SQLite.dll即可,两目录中的不 ...

  4. 未找到具有固定名称“System.Data.SQLite”的 ADO.NET 提供程序的实体框架提供程序

    用户代码未处理 System.InvalidOperationException   HResult=-2146233079   Message=未找到具有固定名称"System.Data. ...

  5. CS0012: 类型“System.Data.Objects.DataClasses.EntityObject”在未被引用的程序集中定义

    entity framework,没在view引用 实体对象时,一直没问题,引用后爆出这个错误来  CS0012: 类型"System.Data.Objects.DataClasses.En ...

  6. 解决System.Data.SqlClient.SqlException (0x80131904): Timeout 时间已到的问题

    这段时间写Android和IOS服务时 sql数据库查询有数据正常,没数据总是报异常:System.Data.SqlClient.SqlException (0x80131904): Timeout ...

  7. System.Data.DbType 与其它DbType的映射关系

    System.Data.DbType 与其它DbType的映射关系 有如下类型的映射对照: System.Data.SqlClient.SqlDbType System.Data.OleDb.OleD ...

  8. System.Data.DbType和数据库映射关系

    有如下类型的映射对照: System.Data.SqlClient.SqlDbType  System.Data.OleDb.OleDbType System.Data.Odbc.OdbcType S ...

  9. Data Base System.Data.OracleClient requires Oracle client software version 8.1.7 or greater解决方案

    System.Data.OracleClient requires Oracle client software version 8.1.7 or greater解决方案 一.问题: 1.通过Syst ...

随机推荐

  1. 通过一个实例理解 offsetLeft,offsetTop; offsetWidth , offsetHeight

    obj.offsetTop 指 obj 相对于版面或由 offsetParent 属性指定的父坐标的计算上侧位置,整型 obj.offsetLeft 指 obj 相对于版面或由 offsetParen ...

  2. Linux驱动开发—— of_property_read_u8

    在使用設備樹的時候, 有時會遇到下面的問題. 在設備樹中配置的屬性如下: fusb301,init-mode = <0x20>; 但是在驅動中讀出的卻是: rc = of_property ...

  3. 【转】基于linux下的dm9000网卡移植全分析

    转自:http://blog.sina.com.cn/s/blog_6abf2c04010189ui.html DM9000可以直接与ISA总线相连,也可以与大多数CPU直接相连.Mini2440采用 ...

  4. 定向爬虫 - Python模拟新浪微博登录

    当我们试图从新浪微博抓取数据时,我们会发现网页上提示未登录,无法查看其他用户的信息. 模拟登录是定向爬虫制作中一个必须克服的问题,只有这样才能爬取到更多的内容. 实现微博登录的方法有很多,一般我们在模 ...

  5. C# 条件编译

    本文导读: C#的预处理器指令从来不会转化为可执行代码的命令,但是会影响编译过程的各个方面,常用的预处理器指令有#define.#undef.#if,#elif,#else和#endif等等,下面介绍 ...

  6. asp.net MVC4——省市三级联动数据库

    数据库设计

  7. Xshell显示中文乱码问题

    [文件]–>[打开]–>在打开的session中选择连接的那个,点击[属性] -> [终端], 编码选择为:Unicode(UTF-8),然后重新连接服务器即可.也可以在Xshell ...

  8. [连载]《C#通讯(串口和网络)框架的设计与实现》- 10.宿主程序详细设计

    目       录 第十章           宿主程序详细设计... 2 10.1        配置文件设计... 3 10.2        加载设备驱动... 4 10.3        加载 ...

  9. Easyui dialog中嵌入iframe

    如果easyui dialog的地址属性用href超链接,easyui 不会加载整个url页面,只会截取url目标页的body体间的html, 如果想加载把其他页面 加载进dialog的iframe中 ...

  10. 基于rem的移动端自适应解决方案

    代码有更新,最好直接查看github: https://github.com/finance-sh/adaptive adaptivejs原理: 利用rem布局,根据公式 html元素字体大小 = d ...