Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQ - which layer should LINQ typically fall into, DAL?

just wanted to gather different ideas and perspectives as to which layer should (and why) LINQ fall into?

like image 375
Murtaza Mandvi Avatar asked Dec 09 '22 23:12

Murtaza Mandvi


2 Answers

LINQ = Language INtegrated Queries. This is the query extensions that allows you to query anything from databases to lists/collections to XML. The query language is useful in any layer.

However, a lot of people refer to LINQ to SQL as just "LINQ". In that context, a combined BLL/DAL makes sense when you're using L2S and that's where you do LINQ queries against your database. That does of course not exclude doing subsequent queries against the results from those same queries in new (Linq to objects) queries in higher layers...

like image 132
KristoferA Avatar answered Jan 06 '23 21:01

KristoferA


it depends on what you want to do with linq. when using linq2sql i`d recommend the DAL, but Linq is more than just database access. you can use it to manipulate lists, ienumerables of business objects and so on... Linq itself can be useful everywhere in your application.

like image 41
Joachim Kerschbaumer Avatar answered Jan 06 '23 21:01

Joachim Kerschbaumer