Linq to SQL for a new project

I'm about to start a new project and I'm deciding which data access technology I will use ... I really like LINQ to SQL for various reasons, but do I need to start a new project using Entity Framework?

I have this perception that the Entity Framework is more bloated and unnecessarily complex, which explains part of the reason I was thinking about LINQ to SQL ... but since I said it might just be perception on my side since I've been so long didn't use Entity Framework.

So what do people recommend using to launch a new project today (note that this app will be around for years to come)?

Cheers Anthony

EDIT: We are a SQL Server store so we don't need an independent database vendor.

Also is the data access acronym best suited with a repository pattern that works with my domain objects?

+2


source to share


6 answers


LINQ to SQL is about fast development and simplicity. If your data model is complex or is about to become, you might be better off using a more robust structure.



However, more important than your data access tool is how well you abstract it from the rest of your code. That's right, you can start with LINQ to SQL and switch when you outgrow it (or when EF 2 4).

+3


source


Note that EF 1 is far from complete. It is missing all sorts of features you find in LINQ to SQL, one of the most important of which is a real foreign key (can you imagine they don't exist in EF 1?)



Also, EF 4 will pretty much have all LINQ TO SQL functionality, and both will generate a relatively comparable (coded) external API, so unless you're coding LINQ to SQL specific APIs it should be relatively easy to migrate to EF4 later "just" by replacing LINQ with SQL.dbml with the EF4 equivalent.

+2


source


Linq to SQL works best in the proactive paradigm of active record / one table per class. If you need to span your class across multiple tables, or support complex inheritance, then this may not be the best choice. Also, Linq to SQL does not support many-to-many relationships (workarounds exist).

If none of these sounds like they would have influenced you, then Linq 2 SQL might be a good choice. This is a great lightweight data access strategy.

Linq to SQL can be used to implement the repository pattern very well given the above constraints. Google will provide some viable Linq repository examples.

+1


source


You took a look at Subsonic - now in version 3 it's basically a linq to sql DAL, which allows you to have a full linq to sql of your entire database in less than 5 minutes. And it runs T4 templates, so if you want to add to templates, this is REALLY EASY

http://www.subsonicproject.com/

0


source


I wrote a rather lengthy blog post on choosing .NET ORM:

.NET and ORM - Solutions, solutions

Basically NHibernate is your best bet. If you insist on something with simplicity like LinqToSql, consider SubSonic. I would not recommend either of the Microsoft options: LinqToSql or EntityFramework.

The decision on whether to use the repository pattern or not depends on your requirements.

0


source


0


source







All Articles