Message info From:Alessandro Cavalieri Subject:Re: Castle ActiveRecord lazy/proxy issues Date:Thu, 12 Apr 2012 08:38:32 -0700 (PDT)

If I remember well FindByprimaryKey has an overload:
public static object FindByPrimaryKey(Type targetType, object id, bool throwOnNotFound);

with the overload you can specify the action when the record doesn't exist.


Il giorno mercoled 4 aprile 2012 22:23:09 UTC+2, Tim Schmidt ha scritto:
Follow up question, in this case I don't really even care to lazy load.  Can I bypass that behavior for this one call?

On Wednesday, April 4, 2012 3:18:37 PM UTC-5, Tim Schmidt wrote:
I have an ActiveRecord class, let's call it MyClass, that's set Lazy=true at the class level.  When I call ActiveRecordMediator<MyClass>.FindByPrimaryKey(0), I get back a MyClass proxy object (since id 0 doesn't exist).  I guess I would expect to get a null but I can see why I get a proxy.  My question is how the heck do I check if that record actually existed?  Right now, as soon as I access any property on the returned proxy object, I get an ObjectNotFoundException.



You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at