如何改变MySQL的connector,如何自定义的MySQL Connector / NET?

MySql Connector/Net is not working properly. The team working on bugs is only 3 people and they do not resolve complex issues. There are still unresolved issues from 2009. I want to customize their connector so that it works for my complex situation. How can I use a customized version in my project instead of theirs?

解决方案

Step 1) Download

In order to customize a version of oracle's mysql connector / net you are going to have to download the source code here: http://dev.mysql.com/downloads/connector/net/

Step 2) Open

Next, you are going to have to unzip the downloaded source files. The meat of the connector will be in two of the projects, MySql.Data and MySql.Data.Entity ( What is in a mysql provider? ).

Step 3) Edit The Connector

Make any edits to the classes you wish in order to fix your complex situation.

Step 4) Remove the signature

This step will make redistributing your edits undesirable, you may sign it and make the changes if you wish but for a local deployment it is unnecessary.

Inside of MySql.Data.Entity's AssemblyInfo.cs comment out this line:

//[assembly: AssemblyKeyName("ConnectorNet")]

Inside of MySql.Data's AssemblyInfo.cs make these changes:

//[assembly: AssemblyKeyName("ConnectorNet")]

[assembly: InternalsVisibleTo("MySql.Data.Entity")]

Step 5) Compile and Build In Order

Build MySql.Data first. Once built, open MySql.Data.Entity. There will be a warning about not being able to find MySql.Data. Add the reference to the newly built MySql.Data inside of the bin/Debug folder. Build MySql.Data.Entity as Release.

Step 6) Move the files

Inside of the bin/Release folder of MySql.Data.Entity should be both MySql.Data and MySql.Data.Entity. Take each one and overwrite their counterparts in your project's package folder.

Step 7) Update References in your project

Inside of your project, go to the references area. Remove both MySql.Data and MySql.Data.Entity. Right click on References, click Add Reference, select the Browse tab, navigate to the package folder, and then add both MySql.Data and MySql.Data.Entity that you placed there in Step 6.

Step 8) Modify web.config

There will be several mentions of MySql.Data inside of web.config. Each one of them will have PublicKeyToken=c5687fc88969c44d which must be removed (from all of them).

Step 9) Make it so

Enjoy your customized connector!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值