Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

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.

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.

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.

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.

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top