views:

554

answers:

2

The kind of flexibility that Activerecord gives to our DB design, we are looking at it for our DAL and build model around it. We will be creating a WCF service on top of all this. Are there any gotchas or compat issues when using NHibernate based Castle Activerecord? Specially when it comes to the DataContractSerializer that WCF uses. Since ActiveRecord will not be using IQueryable, is it too much to miss??

+1  A: 

Serialized object = detached object. And once you send an object over the wire via WCF, that's what you've got.

So the big issue is that you're going to be dealing with when using NHibernate with WCF is detached objects, which forces you to write your code a bit differently. You lose NHibernate's caching abilities and lazy loading features. You've got to pre-load your aggregates before you ship them off over the wire.

Of course that's all moot if you utilize data transfer objects instead, but since you mentioned ActiveRecord I am guessing that wasn't the plan.

I may be way off base here. Hopefully an ActiveRecord guru can give more details.

Chris Holmes
+1  A: 

While not specific to WCF and Castle Activerecord I do offer a warning.

Make sure you don't have any CASCADING DELETEs defined at the persistance layer. Let ActiveRecord handle those for you else you will encounter annoying errors later one (recieved 0 expected 1) type things that aren't very clear.

Also, if you need to do frequent bulk deletion you may want to be careful using ActiveRecord at all as the Castle Implementation doesn't support a bulk delete but instead requires a costly loop over each item to be deleted and individual deletes to occur.

Bill Rawlinson