I am building a DAL layer for fun and learing (some fun i have), and i want it to be the generic as can be.
Is it smart to create a DAL manager that can create the Dal specific by using the generic <>
.
For example i have a class Customer
with the some property lets say Name
but it does not matter.
and for creating the specific Dal class we will do this :
IDal customerDal = DalManager<ICustomer>.GetDal();
i imaging using IoC
under the hood and so on.
1. Do you think it is a good idea ?
2. Is there a an example project some where on the web (a good one, i found some bad ones).
Thank you very much you are all awesome.
No, this is a bad idea. NHibernate is already an abstraction over your database, you don't need another one.
See http://code.google.com/p/nhjump/ for an example of the Repository pattern being used with NHibernate