Search code examples
.netormsubsonicn-tier-architecturedecoupling

SubSonic data layer that returns POCOs instead of SubSonic's ActiveRecord objects


I want to use SubSonic (2.2) in an application I'm building because I like its simplicity and it handles any type of query I can foresee needing. At the same time, I want to keep the upper layers of my application de-coupled from the Subsonic Types. I want to return just Plain Old C# Objects and also pass in POCOs to be saved.

But here's the catch: I want my POCOs to have Lazy loaded properties for Child collections and parent objects based upon the FK relationships. I figure I need to somehow put a Subsonic SqlQuery object in a private member on my POCO and use that internally in the getter for a lazy loaded property.

Any ideas about how to implement this specifically with SubSonic? Anyone done this before?

I do realize that the next major release of SubSonic will do this out-of-box, but that looks to be atleast a few months away.


Solution

  • Couldn't ever figure out a good way to do this. Subsonic 3 is looking very nice and would solve the problem, but in the mean time we just went with NHibernate.