views:

109

answers:

6

Thus far used sql server stored procedures for all my web applications... Now thought of moving to an ORM... I would like to ask SO users about LINQ to SQL

Is Linq to sql worth a try as a beginner to an ORM?

or should i look for some others... Any suggestion...

EDIT:

I have a sql server 2005 database with all tables....

How to use this db with Linq to sql?

+2  A: 

Coming from a similar situation I found linq-to-sql worked really well. We previously used a repository pattern and managed to follow it pretty closely with linq to sql in about half the time. Linq-to-Sql will also allow you to write and use regular store procedures.

For a beginner I found the linq-to-sql sections of the Nerd Dinner tutorial a good starting point.

Luke Lowrey
+5  A: 

Coming from using ADO.NET table adapters, LINQ was a revelation. A breath of fresh air. The veil was lifted. A new day dawned. And so on and such forth.

Start with Scott Gu's series here and check all his other blogs on the subject.

I envy you your impending joy.

BigChrisDiD
I had a very different experience with LinqToSql. I'm glad yours was so pleasant.
Michael Maddox
I had a terrible time as well until I figured out that you just have to put the select on the bottom instead of the top. After that it was query.where and the rest was a doddle.
BigChrisDiD
+2  A: 

Skip it. Second grade little ORM missing all the interesting features (and don't get me even started with EntityFramework - crap in v1, barely usable in v2).

I suggest getting ahold of NHibernate.

TomTom
Please elaborate on these missing features of Linq2SQL that is so sorely missed.
leppie
Second level caching to start with. The ability to have one object model in an application distributed over multiple assemblies and dynamically determine at program start which objects get mapped - good for modular applications that can be extended.
TomTom
@TomTom: I don't know about the second level caching thing, but a `DataContext` will keep all loaded objects in memory, which prevents reloads. As for the multiple assembly approach, how is this not possible? I haven't tried it, but I cant see why it cannot work.
leppie
@leppie - this is the first level cache, per transaction. This sucks for large high performance installs where many objects hardly ever change (reference data) or rarely change (check timestamp, for example) but are hard to load. A second level cache CAN make you a lot faster.
TomTom
For the multi assembly approach a DataContext is basically generated code without provision for including other assemblies that are not known. This makes partitioning larger applications (like 300 persistent objects) hard, where it may make sense to hav separate assemblies for user management, accounting, content etc. (in one web shop, for example). Enterprise Framework can do it.
TomTom
+2  A: 

Even though I, unfortunately, don't do much Windows/.NET development anymore, I still think that C#/.NET is the best programming environment around and that Linq is a great ORM. If you're on the .NET/C# platform, use it. There's good documentation, a large community of users to help you, and very solid implementations.

While Microsoft SQL Server doesn't get a lot of buzz, it is a very worthy database to be the platform underlying linq.

ראובן
+2  A: 

If you're just starting, then I recommend you ignore LINQ to SQL. Microsoft will be placing all of their development efforts behind Entity Framework, which is more powerful and general than LINQ to SQL.

John Saunders
+2  A: 

Personally, I think that L2S is a great choice for a ORM beginner because it's really easy to use, but still gives you plenty of power. IMO, if you are doing new SQL Server work, L2S is the best and easiest ORM available. It's not perfect, but neither is anything else out there.

Also, PLINQO adds a lot of the missing features to L2S that bring it more in line with EF, while maintaining the simplicity and speed of L2S.

Eric J. Smith