What are the responsibilities of the data layer?

Posted by alimac83 on Stack Overflow See other posts from Stack Overflow or by alimac83
Published on 2013-11-01T09:42:55Z Indexed on 2013/11/01 9:54 UTC
Read the original article Hit count: 222

Filed under:
|
|

I'm working on a project where I had to add a data layer to my application. I've always thought that the data layer is purely responsible for CRUD functions ie. shouldn't really contain any logic but should simply retrieve data for the business layer to manipulate.

However I'm a little confused with my project because I'm not sure whether I've structured my app correctly for this scenario.

Basically I'm trying to retrieve a list of products from the database that fall within a certain pricing threshold. At the moment I have a function in my data layer that basically returns all products where price > min threshold and price < max threshold. But it got me thinking that maybe this is incorrect. Should the data layer simply return a list of ALL products and then the business logic do the filtering?

I'm pretty confused over whether the data layer should simply provide methods that allow the business layer to get raw data or whether it should be responsible for getting filtered data too?

If anyone has an article or something explaining this in detail it'd be very helpful.

Thanks

© Stack Overflow or respective owner

Related posts about .NET

Related posts about design-patterns