Page 1 of 1
.Net to MySQL
Posted: Mon Jan 06, 2014 7:43 pm
by hallsofvallhalla
When looking for .Net hosts I am finding many have MySQL db options only. Is there a god library out there for connecting the two? I am not finding much. Anyone have any suggestions/advice on it?
Re: .Net to MySQL
Posted: Mon Jan 06, 2014 8:40 pm
by Jackolantern
Yaay! I wrote a
tutorial on this very topic! I hope it is still up to date

Re: .Net to MySQL
Posted: Mon Jan 06, 2014 8:48 pm
by hallsofvallhalla
haha i remember reading this and knew I had read one but could not for the life of me remember where I seen it at...Hehe now I know!
Thanks!
Re: .Net to MySQL
Posted: Mon Jan 06, 2014 10:43 pm
by Jackolantern
Awesome! Glad it can be useful!

Re: .Net to MySQL
Posted: Tue Jan 07, 2014 4:31 am
by a_bertrand
I would either use nhibernate or
http://www.devart.com/linqconnect/ instead of ADO.NET

Re: .Net to MySQL
Posted: Tue Jan 07, 2014 5:20 am
by Jackolantern
Of course ORMs are likely a better option. NHibernate is a fairly complex option, however, and the tutorial was designed to just get the job done. NH is likely overkill for a smaller project.
As a side note, it is very irritating that EF doesn't support MySQL out of the box. I understand that MS sells SQL Server, but it supports Oracle and DB2. Why not the most popular RDBMS in the world?
Re: .Net to MySQL
Posted: Tue Jan 07, 2014 5:33 am
by a_bertrand
Beside the support for Oracle is nearly non-existant and you have to rely to some other options, it was not coded by MS but by Oracle which gave the thing to MS. Keep in mind you can't natively do LINQ to SQL to Oracle or any other DB beside MS SQL. So the only thing offered by .NET is ADO.NET to Oracle or DB2... which basically you can do to MySQL as well with a single simple download (and for free). I don't see much difference. Even for oracle you are forced to download a better ADO.NET from Oracle website... basically the same effect.
Re: .Net to MySQL
Posted: Tue Jan 07, 2014 6:52 am
by Jackolantern
Actually, technically you can't really natively connect Entity Framework to any database. Every RDBMS requires a mapping layer. EF only connects to an interface. MS SQL's mapping layer is included out-of-the-box with EF, but there are mapping layers available for
Oracle and
DB2.
Now that I think about it, it is likely that Oracle and DB2 mapping layers exist because these are commercial products where a company has a financial interest in creating the (fairly complex) mapping layers for their respective RDBMS. But I would still think this would have been undertaken by the open source community that supports MySQL. MS does publicly allow for the creation of new mapping layers.
EDIT: Actually, this exact thing is
possible, at least on some level (I have no idea how complete or useful it is).
Re: .Net to MySQL
Posted: Tue Jan 07, 2014 7:10 am
by a_bertrand
I gave the link to LinqConnect which offer actually a better option than what MS offer even for MS SQL. It's free to use up to 10 tables, then you need to pay a license.
And I fully know you can develop your own, I even started to make my own before finding LinqConnect which I then purchased here at work.
Why MS should offer it for all? No need. Even Java doesn't offer ANY mapping to any DB. They offer the base DB factories, and then each provider need to code their own. For me it is the right way to do it. It is not like MS is developing NVIDA and AMD graphic drivers, right? Well same for DB. If you choose a DB, then you will have to go to the DB provider to provide you with a DB driver.
Now you could arguee that MS do offer it for MS SQL, well, sure, they develop the DB too, why not offer it directly? Also, SQL Express is free to use up to 10GB of DB, 1GB of ram and a single socket CPU. For me, that should fit any hobby / amateur project. If your project requires more, then you can purchase a MS SQL license.
BTW If you never worked with MS SQL or SQL Express, I would say you should try it. It's actually much better than MySQL

Re: .Net to MySQL
Posted: Tue Jan 07, 2014 7:23 am
by Jackolantern
I never denied that it was. I enjoy MS SQL. But MySQL is the most popular RDBMS in the world, so of course many people will be using it.
I had never heard of LINQConnect, but will check it out. I was worried the prices would be very high (as I am sure you know, a ton of third-party .NET tools and libraries are designed for enterprise development and cost thousands of dollars), but they weren't bad at all single developers.
If I do start working with .NET in a serious way again, I will check it out. But for now I am mostly working with node and MongoDB.