views:

90

answers:

0

Details: C# 2.0, SQL Server 2005

I have recently relinquished the idea that I would be able to get NHibernate working with my project. It would have worked great if I had started with it, but now it just can't adapt to my application. Which is in all honesty probably more an issue with my application that it is NHibernate.

Regardless, what I am doing now is rewriting my DAL to be much more flexible, or trying anyways. So what I have is MetaDataMapper class that accepts a registration at application startup much like such:

MetaDataMap.RegisterTable(typeof(User), "tblUsers");

This registration method actually maps the columns in the table to the properties using property attributes. Then I also have Data Mapper classes. Which data mapper to use is determined by a DataMapper factory that has a generic method and based on the type provided to the method it uses a Locator class that is registered upon application startup as such:

MapperLocator.RegisterMapper(typeof(User), typeof(UserMapper));

So, when I get my controller I have access to my data access methods. Well since I am very early in development of this I have been able to successfully get an object mapped and retrieved from the database. Now I am trying to figure out how to do deep loading cleanly and effectively and how to intertwine that with the desired ability to lazy load.

I know this is a bit vague and lacking of source, but I am mainly looking for patterns, ideas, links, etc.

Thanks in advance!