开发者

How to connect to a MySQL database inside the .NET framework?

I'm opening a discussion here on a subject I couldn't find any answer good enough to be called a final answer: MySQL and .NET.

While I know there is a lot of ways to make this connection, I'm trying to find a list of pros and cons of each approach.

I've been using ADO.NET with the MySQL NETconnector since the beggining of my project, and everything was ok when the database was new and开发者_如何学编程 didn't have many records. But now I'm facing a situation where the number of records grows exponentially, and I found other way of querying against the database, which is the ODBC connector. Using the ADO.NET + NETConnector solution I had my O/RM and didn't have to write my queries, while ODBC makes my code look awful now (since I didn't switch completely to ODBC, I have Linq queries and plain SQL queries inside my code).

Is there any solution (free or not) where I can have both an O/RM without the need of writing SQL queries myself and the speed of ODBC?


What you should be doing is using the MySQL ADO.NET Connector and storing your queries in the database in the form of stored procedures. Version 6.0 of the MySQL connector also supports The Entity Framework. If you are interested in using the Entity Framework, check out this link which describes how to set that up.


NHibernate

Update to Comments

NHibernate Proxy Generators It is a byte code generator for your object model that allows NHibernate to perform lazy loading and other operations. The link provided explains the benefits.

Castle and LinFu are two different implementations of those Proxy Generators.

While NHibernate does not have coincide documentation all the information on how to use it, is on the internet. This could be a barrier to usability for some people though. I understand more about NHibernate because of my past experience with Hibernate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜