Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP MVC: Should services return IQueryable's?

What do you think? should your DAO return an IQueryable to use it in your controllers?

like image 812
SDReyes Avatar asked Feb 06 '10 22:02

SDReyes


1 Answers

No. Your controllers shouldn't be handling any complex logic at all. Keep them slim; the Model (not DAO) should hand the Controller back everything it needs to pass onto the View.

Seeing queries (or even queryables) in a Controller class is something I would consider to be a code smell.

like image 110
Aaronaught Avatar answered Sep 28 '22 01:09

Aaronaught