Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 345
nandos Avatar asked Oct 30 '08 14:10

nandos


2 Answers

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:

  • Some stackoverflow users question Linq to SQL's continued support.

Also evaluate the ADO.NET Entity Framework and here.

like image 108
Corbin March Avatar answered Sep 28 '22 02:09

Corbin March


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
like image 45
James Curran Avatar answered Sep 28 '22 00:09

James Curran