Using LINQ with databases other than SQL Server Express 2005 - mysql

I'm just starting to look into using LINQ for my database (and XML, and data object!) needs, but need to decide on which database to go with. I've been reading Pro LINQ, and it says that currently, LINQ in .NET 3.5 only supports SQL Server. I have done some googling, and have found references to using LINQ with MySQL and PostgreSQL (my other two DB options), but they are refer to DLinq, which I understand to be the predecessor of LINQ to DB.
I've read interesting and informative comparisons of the three databases here and here, but am still torn. I do not have any in-depth database experience, so it's important to be able to get the software installed and configured easily, or at least be easy to figure out how to compile a list of steps to configure it. I definitely want to have transactional support as well. But most importantly -- I want to use LINQ.
I'd like to hear what everyone here is using, whether it's SQL Server because LINQ supports it natively, or the other two with some additional component for LINQ support that I haven't yet found.

We use devart's dotConnect provider for Linq-to-Oracle and have been very pleased. They try and make the functionality match Linq-to-SQL as close as possible, which seems to be what you're looking for.
They have providers for:
Oracle
MySQL
PostgreSQL
SQLite
SQL Server
From a cost perspective, it's an excellent deal I'd say, just pay for developer seats, no server licensing.

Related

Best portable DB engine that supports Linq

I need to know what is the best portable db, for this situation
I've an application base on sql server db, we use both LINQ TO SQL, and ADO.NET, in this application.
Now we need to make a portable version of it, but the fact we are using Linq To Sql, preventing us from using MS Access, as there is not out of the box solution for that (other than some 3rd parties, and we don't want to use them).
So I need to a db engine that is:
Portable
Have Linq support.
if it is not completely portable, is there is a one that can be easily attached & deattached, from client PC.
Did you check out SQL Compact Edition?
Downloadable for free and a list of reasons why to use it
It seems the latest and greatest version (4) does not support LINQ-to-SQL, but the previous version (3.5) does.
Check this code project article: LinqToSQL: Comprehensive Support for SQLite, Microsoft Access, SQServer2000/2005
Hope this helped.

DBLinq for a production system?

We're working on an ASP.NET web application with C# code behind. The database is MySQL 5.1 using InnoDB. The data access layer uses ADO.NET to call stored procedures and then builds various data structures out of the result sets (no object mapping). This works fine, but it is a little verbose.
Not surprisingly, we made some mistakes when designing the first version of our data model, but the experience has made us smarter and we decided to refactor the data model. We don't have to change our data access layer, but we are considering our options for that as well.
It's been difficult for us to ignore the popularity of ORM tools these days; we feel like we are way behind or something for not being familiar with them. Not only that, but we have already designed an object model that nicely describes our data model. The main ORM tools we would consider are NHibernate, ADO.NET Entity Framework, and LINQ to SQL. We would prefer LINQ to SQL because we have read (on S.O.) that it is more light weight than full ORM tools.
We think one drawback to using an ORM tool is the learning curve, but we can already see how using LINQ could reduce the amount of code we will have to write, which could save us time in the long run. However, we are using MySQL, not SQL Server.
So my question is, would DBLinq work well enough for a production system? Or, is LINQ to SQL a compeling enough reason for us to make the move to SQL Server 2008? Incedentally, I'd prefer to use SQL Server over MySQL, but cost is the obvious drawback. After 3 years on BizSpark, we'd be on the hook for $6K. Or, should we consider other ORM tools instead? Or, should we just ignore the hype and not use an ORM tool, but maybe take advantage of LINQ to DataSet?
I searched S.O. for info on DBLinq, but only found 17 questions with the DBLinq tag, so it doesn't appear to be popular.
EDIT
Looks at though dotConnect for MySQL has support for LINQ, so that's another option.
Can anyone speak to how well that driver works for writing LINQ queries?
Check bl-toolkit. It's free, very fast and has great LINQ support. Newest addition are T4 templates for generating your data model from database.

How to use different providers for Linq to entities?

I'm trying to familiarize myself a bit more with database programming, and I'm looking at different ways of creating a data access layer for applications. I've tried out a few ways but there is such a jungle of different database technologies that I don't know what to learn. For instance I've tried using datasets with tableadapters. Using that I am able to switch data provider rather easily (by programming against the interfaces such as IDbConnection). This is one thing I would want to achieve. But I also know everyone's talking about LINQ, and I'm trying to get to know that a bit better too. So I have tried using Linq to Sql classes as the data access layer as well, but apparently this is not provider independent (works only for SQL Server).
So then I read about the Entity Framework (which just as Linq to SQL apparently has gotten its share of bashing already...). It's supposed to be provider independent everybody says, but how? I tried out a tutorial to create an entity data model, but the only providers to choose from were SQL Server/Express. Just for learning purposes, I would like to know how to use the entity framework with MS Access/OleDb.
Also, I would appreciate some input on what is the preferred database technology for data access. Is it LINQ still after all the bashing, or should you just use datasets because they are provider independent? Any pointers for what to learn would be great, because it's just too much to learn it all if I'm not going to use it in the end...!
the only providers to choose from were SQL Server/Express
The .NET Framework only includes EF providers for SQL Server and SQL Server Compact. If you need to access another DBMS, you need to install a third-party provider. For instance, there's a free provider for SQLite, with designer support. There are also a few (commercial) providers made by Devart, for various DBMS. As far as I know, there are no EF providers for OleDB or ODBC...
I really like the metaphor from Scott Hanselman: "I'm not a plumber, but I do know what an S-Bend is."
Personally, I think you should have a working knowledge of all the variety of ways to access data.
ADO.Net, EF, Linq2Sql, txt files, xml etc etc etc.
Have a look at the Nerd Dinner and the Music Store samples. See the way they access data (how do they do Unit Tests, Mocking framework, IOC etc)
Regarding data providers, personally I would avoid Access. It is just as easy to get a Sql Express or Mysql installation running and looks better on your resume.
(For what its worth, this question discusses setting up mysql for EF.)

What database vendors does LINQ to SQL support?

I'm kind of new using LINQ to SQL and when ever I try to use a non sql server dbs I get an error that it is an unsupported data provider. Is there a way to get LINQ to work with dbs like Oracle and SQL sdf files?
In order to use LINQ to communicate with a given DB backend, you need to get a DB specific provider. For oracle, try the following project on codeplex
http://www.codeplex.com/LinqToOracle
The DbLinq project supports all of Linq to Sql's features over MySQL, PostgreSQL, Oracle and SQLite, as well as some unique features. It is also the base of Mono's implementation of Linq to Sql.
Not officially, but there are a variety of projects implementing LINQ to SQL for other databases, for example: http://www.codeplex.com/LinqToOracle
Although you specified LINQ to SQL you might also want to consider the Entity Framework which does support different databases. You can find some supported providers here. The first 3 providers on that page support ORACLE.
If you want start a new project that is not SQL Server and you want to use a Microsoft ORM I recommend you to start using Entity Framework which supports MySQL and Oracle and ... and also you can use LINQ to Entity to communicate between your application and EF generated classes.
Hope this helps
Take a look at the Devart LINQ to Oracle tutorial.
But please note that you are not able to mix data from SQL Server and Oracle datacontexts.

New Project : MySQL or SQL 2005 Express

I am starting a new client/server project at work and I want to start using some of the newer technologies I've been reading about, LINQ and Generics being the main ones. Up until now I have been developing these types of applications with MySQL as clients were unwilling to pay the large licence costs for MSSQL.
I have played around a small amount with the express versions but have never actually developed anything with them. The new application will not have more than 5 concurrent connections but will be needed for daily reporting.
Can MSSQL 2005 express still be downloaded? I cant seem to find it on the microsoft site. I would be hesitant to use MSSQL 2008 on a project so soon after its release.
Are the express version adequate for my needs, I'm sure loads of people reading this have used them. Did you encounter any problems?
The answer to the question on any project in regards to what platform/technologies to use is: What does everyone know best?
Yes express can still be downloaded.
Will it fit your requirements? That depends on your requirements, of course. I have deployed MSSQL2005 Express on several enterprise level projects which I knew had a fixed database size that would never be exceeded (Express has a limit of each database of 4Gb). Also keep in mind there are other hardware constraints such as a 1 cpu limit.
Another thing to consider is if you need the Enterprise level tools that come with a paid edition of SQL Server. If you are moving a lot of flat data around you are stuck writing your own Bulk Copy Procs, which rule the house, but its an extra step, no doubt.
Note sure about #2 but you can download SQL Server Express 2005 here.
Sql express has more features, and is a lot more powerful, but will only run on windows boxes. If you ever need to scale Sql express can be switched easily to a commercial variant.
MySql doesn't support half the features, but does have most of the basic ones you actually need, and will run on windows or *nix boxes. It's also not throttled in the same way as Sql express is.
In my opinion (having used both extensively, but not touched MySql for a few years) Sql express is a far better DB system. If you're building .Net applications the Linq support is a deal clincher.
If you aren't going for pure Sql server support, I wouldn't go for pure MySql support instead. Use a DBFactory design pattern to load your data layer or use simple SQL:92 syntax that's a lowest common denominator.
Why not go to Sql server express 2008?
I'm mostly going to advocate MS SQL Server because of .NET integration. Linq To Sql is pretty much my favorite way to do deal with databases these days: anonymous functions make everything better! My current place of work has also used MSSQL Express for real projects, so you have at least two of us confirming that the restrictions aren't too harsh.
I have about 50 web sites running perl/apache/mysql and about 10 running C#/ASP.Net/SQL Server (Lite) and other (large) applications running on SQL Server (Heavy). I never have problems with SQL Server - it just works. I often have problems with MySQL.
My advice would be to go for the SQL Server based option even if you had to pay for it.