How to fix Column 'InvariantName' is constrained to be unique 解决办法!
Introduction
When you build a web project that uses Enterprise Library Community for the Application Data Block and the MySQL .NET / Connector, VisualStudio throws the error "Column 'InvariantName' is constrained to be unique. Value 'MySql.Data.MySqlClient' is already present", but you added it only once.
Is very simple to fix, you need to add "<remove invariant="MySql.Data.MySqlClient"></remove>
" to the start of system.data > DbProviderFactories node.
Background
You can be confused if you used XML transform for Web.Config, Web.Debug.Config or Web.Release.Config.
But you shouldn't focus in that. The problem is the provider's installation put in machine.config the childNode<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient"
and normally you put the same manually in your web.config file. So at the compiling time, when web.config heritates maching.config, it results in duplicate "add" child with the same invariant attribute, with the value "MySql.Data.MySqlClient" .
The examples of use around Internet and the tutorials of ELContrib Application Data Block add the DbProviderFactories node to System.Data
element. It suposes that the MySQL .NET/Connector aren't installed in system. It suposes the mysql.data.dll is referenced in any directory and the configuration isn't heritated frommachine.config.
Using the code
Your XML block must be like this to solve the problem:
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"></remove>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.2.4.0, Culture=neutral" />
</DbProviderFactories>
</system.data>
Remember to add <remove invariant="MySql.Data.MySqlClient"></remove>
at the start of DbProviderFactories.
How to fix Column 'InvariantName' is constrained to be unique 解决办法!的更多相关文章
- navicat连接PostgreSQL报:column “rolcatupdate” does not exist ...错误的解决办法
avicat premium 连接PostgreSQL出现: column “rolcatupdate” does not exist ... 错误如图: 解决方案: 看看你的navicat 是否为最 ...
- Java开发问题:Column 'AAA' in where clause is ambiguous解决办法
当在java开发中遇到了Column 'AAA' in where clause is ambiguous问题时, 你需要去看看:多表查询的时候不同的表是否出现了相同名称相同的列, 如果存在,你需要在 ...
- Incorrect integer value: '' for column 'id' at row 1 错误解决办法
最近一个项目,在本地php环境里一切正常,ftp上传到虚拟空间后,当执行更新操作(我的目的是为了设置id为空)set id=‘’时提示: Incorrect integer value: '' for ...
- Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path 解决办法
返回数据解析错误 com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT ...
- 使flex-direction: column的子元素height: 100%生效的办法
在flex-direction: column子元素里直接使用height:100%,height并不会被设置成100% <!DOCTYPE html> <html lang=&qu ...
- idea中Entity实体中报错:cannot resolve column/table/...解决办法。
idea中Entity实体中报错:cannot resolve column/table/...解决办法. 若idea中Entity实体中报错: cannot resolve column.... c ...
- 操作MySQL出错提示“BLOB/TEXT column request_data in key specification without a key length”解决办法
错误原因: 查阅资料后才知道,原来Mysql数据库对于BLOB/TEXT这样类型的数据结构只能索引前N个字符.所以这样的数据类型不能作为主键,也不能是UNIQUE的.所以要换成VARCHAR,但是VA ...
- SQLite无法使用drop column删除表字段解决办法
由于项目需求变更,我需要在sqlite数据库的表中删除一个字段,通用的sql操作语句如下: alter table record drop column name; 结果数据库提示如下错误: 搜索得知 ...
- 使用JdbcTemplate报 Incorrect column count: expected 1, actual 5错误解决
Incorrect column count: expected 1, actual 5 在使用jdbc的querForObject queryForList的时候,出现Incorrect colum ...
随机推荐
- Flex与Java交互(Flex调用java类展示数据)解析xml展示数据
Flex与java通信最简单例子(详细说明了各种需要注意的配置):http://blog.csdn.net/u010011052/article/details/9116869 Flex与java通信 ...
- Vijos P1881 闪烁的星星
背景 星光闪耀--深蓝色空间 听说过他们的语言 沉默 暮 他们称赞深相互 描写叙述 繁星, 漫天的繁星. 繁星排成一列, 我数一数呀, 一共同拥有N仅仅小星星呢. 星星们是听话的好孩子, 小岛在指挥它 ...
- OpenCV HaarTraining代码解析(二)cvCreateMTStumpClassifier(建立决策树)
HaarTraining关键的部分是建立基分类器classifier,OpenCV中所採用的是CART(决策树的一种):通过调用cvCreateMTStumpClassifier来完毕. 这里我讨论利 ...
- loj1236(数学)
传送门:Pairs Forming LCM 题意:题意:问符合 lcm(i,j)=n (1<=i<=j<=n,1<=n<=10^14) 的 (i,j) 有多少对. 分析: ...
- 通过memcached来实现对tomcat集群中Session的共享策略
近期在做一套集群的实现,实现的方案是在Linux下完成对Apache + Tomcat 负载均衡的功能. 上述功能已经实现,有需要了解的朋友可以看我另外一篇博文. Linux下Apache与Tomca ...
- 金句: "對比MBA學位,我們更需要PSD學位的人!" Poor, Smart and Deep Desire to… | consilient_lollapalooza on Xanga
金句: "對比MBA學位,我們更需要PSD學位的人!" Poor, Smart and Deep Desire to… | consilient_lollapalooza on X ...
- Linux下安装Python3.3.0
Linux下安装Python3.3.0_路易_新浪博客 Linux下安装Python3.3.0 (2013-01-08 11:45:37)
- linux LNMP自动安装脚本
#!/bin/bashsoft_dir="/home/soft"config_dir="/home/config"httpd="httpd-2.0.5 ...
- svnkit添加节点
package com.repositoryclient.svnoptions; import org.tmatesoft.svn.core.SVNException; import org.tmat ...
- 为了找到自己的路——leo锦书62
<Leo锦书(文章1编辑)>百度已经降落阅读,今后将继续更新.免费下载:http://t.cn/RvawZEx 柯克•卡梅隆是谁呢?在中国听过这名字的人预计不多.但看下封面我们马下就会说: ...