views:

1653

answers:

10

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.

A: 

We write our own datalayer or have it generated vs our datasource with a program we wrote. I'd be interested to know what benefits you get from using something like LINQ/Subsonic.

thismat
+2  A: 

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
James Curran
+11  A: 

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.

Corbin March
Note that ASP.NET MVC's Dynmanic Data pages create a scaffolding very similar to SubSonics, but based on LINQ.
James Curran
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.
Rob Prouse
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"?
Corbin March
A: 

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.

Aaron Fischer
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.
James Curran
I ment "linq to sql" your right linq is not going anywhere. This latest post from ADO.NET blog would support this position http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx
Aaron Fischer
A: 

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.

+1  A: 

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.

kgiannakakis
A: 

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.

Dwight T
+1  A: 

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 class, 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.

David Robbins
+1  A: 

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.

metanaito
+1  A: 

Entity Framework offers significantly better performance than Subsonic:

http://www.timacheson.com/Blog/2009/jun/entity_framework_vs_subsonic

Tim