zoukankan      html  css  js  c++  java
  • 启用SQLite的Data Provider 运行WECOMPANYSITE时遇到ERROR CREATING CONTEXT 'SPRING.ROOT': ERROR THROWN BY A DEPENDENCY OF OBJECT 'SYSTEM.DATA.SQLITE'

    从网上下载的源码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左边的那个安装包。

  • 相关阅读:
    vue的nuxt框架中使用vue-video-player
    多线程学习笔记-1
    Java模拟简单的KFC程序
    Hankson最大公约数最小公倍数的“逆问题”
    C语言实现三天打鱼两天晒网
    关于border-color的一些小问题
    CSS的超链接样式设计
    CSS ID选择器&通配选择器
    CSS标签选择器&类选择器
    CSS布局属性
  • 原文地址:https://www.cnblogs.com/xdot/p/5966748.html
Copyright © 2011-2022 走看看