dinger2121
Programmer
Hello,
I am stepping back and taking a look at my data access layer and I was hoping someone could give me some guidance in regards to it.
Currently I am using nhibernate to get all of my data mapped to objects. my dal has 2 projects, one called data access layer and one called data transfer. The data transfer project has my fluent mapping files and my object definitions. That piece is ok.
my second project is where everything happens. I have 2 classes in this project - my data provider class and my session manager class. The session manager class is pretty straightforward - that manages my session factory. My question is in regards to my data provider class.
Currently, my data provider class is where I get all of my data from. It has various methods which are actually my nhibernate criteria queries. I've got many different criteria queries each represented by a separate method.
My question is this - is it correct to have all of these queries in one class? basically (for instance), if I have a product table and a manufacturer table, I've got various queries for each. Generally, I return an IList from my methods, so I may have various criteria queries for product - ie., query by product number, query by product type, etc., and similar queries for manufacturer.
Does it make sense to create a product and manufacturer interface and then have each implementation represent a different criteria query, or is that overkill?
I hope that all makes sense. I am just looking to set up my DAL using "best practices" and was just hoping someone can either validate what I am doing or point me in a better direction.
Thanks for any thoughts.
carl
MCSD, MCTS:MOSS
I am stepping back and taking a look at my data access layer and I was hoping someone could give me some guidance in regards to it.
Currently I am using nhibernate to get all of my data mapped to objects. my dal has 2 projects, one called data access layer and one called data transfer. The data transfer project has my fluent mapping files and my object definitions. That piece is ok.
my second project is where everything happens. I have 2 classes in this project - my data provider class and my session manager class. The session manager class is pretty straightforward - that manages my session factory. My question is in regards to my data provider class.
Currently, my data provider class is where I get all of my data from. It has various methods which are actually my nhibernate criteria queries. I've got many different criteria queries each represented by a separate method.
My question is this - is it correct to have all of these queries in one class? basically (for instance), if I have a product table and a manufacturer table, I've got various queries for each. Generally, I return an IList from my methods, so I may have various criteria queries for product - ie., query by product number, query by product type, etc., and similar queries for manufacturer.
Does it make sense to create a product and manufacturer interface and then have each implementation represent a different criteria query, or is that overkill?
I hope that all makes sense. I am just looking to set up my DAL using "best practices" and was just hoping someone can either validate what I am doing or point me in a better direction.
Thanks for any thoughts.
carl
MCSD, MCTS:MOSS