What would you choose for your data layer today, Linq or Subsonic?
Asked Answered
H

8

7

We are ready to start a brand new project at work, no legacy code. We did use Subsonic in the past and we pretty happy with it. But that was before Linq.

Has anyone had to face this same issue (Linq x Subsonic)?

What was your decision? What were the reasons?

Any insight appreciated.

Hoad answered 30/10, 2008 at 14:34 Comment(3)
Entity Framework offers significantly better performance than Subsonic: timacheson.com/Blog/2009/jun/entity_framework_vs_subsonicInfare
Do you mean LINQ or LINQ to SQL? Because SubSonic supports LINQ since 3.0.Boiney
When I asked the question, last October, Subsonic was at version 2.1 (no Linq). I guess the updated question should be LinqToEntities x Subsonic 3.0.0.3 (as of now).Hoad
V
11

SubSonic

Pros:

  • Nice and simple
  • Scaffolding

Cons:

  • Method signatures often accept string parms (though you're encouraged to use DAO string constants) which can be abused.

Keep in mind:

  • Requires Website project for no-code, hands-off model generation (needs the BuildProvider).

Linq To SQL

Pros:

  • Syntactic sugar in the IDE
  • MS supported
  • View the SQL to be executed in the IDE
  • Allows different levels of fiddling in the model, from auto-generation to explicit definitions down to object properties.

Cons:

  • Complex. You need to learn new concepts like the DataContext to be effective.

Keep in mind:

Also evaluate the ADO.NET Entity Framework and here.

Vulva answered 30/10, 2008 at 15:6 Comment(3)
Note that ASP.NET MVC's Dynmanic Data pages create a scaffolding very similar to SubSonics, but based on LINQ.Frottage
Your first SubSonic con is not true, that is just one way to do it. You can also run sonic.exe or SubStage.exe to generate partial classes that you then include in your DAO project in the solution.Littlefield
By auto generation I mean hands-off. I was blown away by the in-memory data objects when I first saw them and then felt a little let down by the reality. No big deal. I think SubSonic kicks some ass. Maybe not a con as much as a "make sure you look past the glossy packaging"?Vulva
F
3

The one thing I love about LINQ, which I don't think SubSonic handles as gracefully, is automatically dealing with joins.

FROM a in db.Orders
where a.Total > 100
SELECT new {a.Item.Desc, a.Customer.Name};

will automatically generate SQL like thisL

select i.DESC, c.NAME 
from  ORDERS o  
inner join ITEMS on o.ItemID = i.ItemID 
inner join CUSTOMERS c on o.CustomerID = c.CUSTOMERID 
where o.TOTAL > 100
Frottage answered 30/10, 2008 at 14:45 Comment(0)
M
1

What about NHibernate? Is it really out of the picture for new projects? Still, people coming from Java will find it familiar and you can also use it with .NET 2.0 and Mono.

Murrelet answered 30/10, 2008 at 17:1 Comment(0)
T
1

My experience has been primary with SubSonic. It is very straight forward to deploy and you'll have your DAL completed in under a half hour. Bear in mind that this is a Swiss Army knife, as it is designed for utility. Basically you get a class generated per table, as well as the ability to peform lazy loading for collections. You can also execute stored procedures via the framework, so if you have complex data structures you can fetch them from the database and update a class that you hand craft.

I've used it on 5 major projects now, and am impressed with how quickly I became dependent on it.

Towne answered 6/11, 2008 at 0:40 Comment(0)
B
1

I went with Linq because it's built into the framework. For those saying it will not be supported by Microsoft... it's LinqToSql that is going to be phased out. I believe one of the plans is to absorbe it into the Entity Framework.

I'm now using the Entity Framework. It also uses linq and basically it's exactly like linqToSql with more flexibility and power if you choose to use it.

I tend to avoid 3rd party frameworks and orms because eventually they die out as well. I believe they have more of a chance to die out because their life comes from how many people are interested in it and use it. Their life is also heavily dependent on it's main author/contributor.

Bazooka answered 6/11, 2008 at 0:48 Comment(0)
R
0

The biggest risk with linq to sql is that Microsoft will grow tired of it and abandon it. There is a lot of speculation that this has already happened and that only the entity framework will be updated. Subsonic does not suffer from this and worse case you have the source code to make your edits.

Respondence answered 30/10, 2008 at 15:42 Comment(2)
I think this is nonsense. First of all, there "LINQ" (syntax), "LINQ to SQL" and "LINQ to Entities". The latter two are basically code generators to create DataContext objects used by the LINQ syntax. The LINQ syntax isn't going away -- much of C#4 is based on it. Updating code generators is minor.Frottage
I ment "linq to sql" your right linq is not going anywhere. This latest post from ADO.NET blog would support this position blogs.msdn.com/adonet/archive/2008/10/29/…Respondence
R
0

I was in the same situation. LinQ is more "Visual", you do everything inside vstudio, and even Rob admits subsonic have a few things to match it.

IEnumerable, LINQDatasource ( with auto paging) and the visual modeling have convinced me to choose Linq over Subsonic.

Revolving answered 30/10, 2008 at 16:7 Comment(0)
G
0

You might want to look into what happens when MS stops developing LINQ to SQL,as it appears to be happening. SubSonics latest version is easier to create queries and more readable, then their previous version.

Grouch answered 30/10, 2008 at 20:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.