从网上下载的源码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. 无限循环轮播图之JS部分(原生JS)

    JS逻辑与框架调用, <script type="text/javascript"> var oBox = document.getElementById('box') ...

  2. u-boot-2015.04 在tq2440上的移植(使用spl引导u-boot)

    本次移植跟以往的不同之处是采用了spl来引导u-boot,参考了博客http://blog.csdn.net/fulinus/article/details/42738641 下载链接:http:// ...

  3. Linux基礎知識 —— open&close

    下面說一下在用戶空間調用open/close/dup跟驅動中的open和release的對應. 下面是測試驅動: #include <linux/module.h> #include &l ...

  4. 《HelloGitHub月刊》第09期

    <HelloGitHub>第09期 兴趣是最好的老师,<HelloGitHub>就是帮你找到兴趣! 前言 转眼就到年底了,月刊做到了第09期,感谢大家一路的支持和帮助

  5. markdown常用语法总结

    转自markdown示例[模板] 1.1.段落标题 根据原文中的文档标题可以对应设置标题. # 一级标题## 二级标题### 三级标题 效果 => 一级标题 二级标题 三级标题 1.2.斜体.加 ...

  6. 异步编程系列第01章 Async异步编程简介

    p { display: block; margin: 3px 0 0 0; } --> 2016.10.11补充 三个月过去了,回头来看,我不得不承认这是一系列失败的翻译.过段时间,我将重新翻 ...

  7. winForm连接数据库(sqlserver2005)

    帮同学搞个课程设计winform连接sqlserver2005 具体方法: .添加App.config文件 2.在App.config文件中添加节点 <?xml version="1. ...

  8. Yii2.X 多语言-类图

  9. 【转】ZigBee终端入网方式深入分析

    前述 继之前对终端Direct Join的分析,发现很多东西还很模糊,存在很多问题.终于找到时间继续深入挖下去,这次应该比较完整地搞清了终端的入网机制,并纠正之前的几个认识偏差. 由于Z-Stack网 ...

  10. php函数强大的 strtotime

    使用strtotime可以将各种格式的时间字符串转换为时间戳 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 转换常规时间格式 echo date('Y-m-d H:i: ...