Is Lazy Loading only an attribute of the model, or can it be specified at query time too?

8 views
Skip to first unread message

Mike Christensen

unread,
Jan 11, 2012, 1:54:33 AM1/11/12
to castle-project-users
I know I can do something like:

[BelongsTo("Foo", NotNull = true, Lazy = FetchWhen.Immediate)]
public Foo Foo
{

}

And this field will be populated immediately rather than when the
getter is accessed.

However, is it possible to specify whether the fetch is done
immediately when I run the query, such as here:

MyModel[] foo = MyModel.FindAllByProperty("User", someUser);
//Sometimes I want lazy, sometimes I don't..

I believe Rails has some sort of syntax for this, I'm wondering if
Castle ActiveRecord does as well. Thanks!!

Mike

Jason Meckley

unread,
Jan 11, 2012, 8:38:48 AM1/11/12
to castle-pro...@googlegroups.com
yes, you can override laziness at runtime.
Reply all
Reply to author
Forward
0 new messages