Eager fetching in [ARFetch]: My first real contribution in the last
months, since I've been busy a lot.
The usage is:
public void ShowPosts([ARFetch(Eager = "Posts")] Blog blog) { ... }
It's useful when you know that you'll iterate through a lazy
collection in an specific action, and want to save the database
roundtrip without hacking your mappings.
Ayende,
Can you check the changes on r3723? Is that the best way to perform
eager fetching when loading an object?
I'm pasting the relevant code:
// load using eager fetching of lazy collections
DetachedCriteria criteria = DetachedCriteria.For(type);
criteria.Add(Expression.Eq(pkModel.Property.Name, convertedPk));
foreach (string associationToEagerFetch in attr.Eager.Split(','))
{
string clean = associationToEagerFetch.Trim();
if (clean.Length == 0)
continue;
criteria.SetFetchMode(clean, FetchMode.Eager);
}
object[] result = (object[]) ActiveRecordMediator.FindAll(type, criteria);
if (result.Length > 0)
instance = result[0];
--
Fábio David Batista
fabio.dav...@gmail.com
http://nerd-o-matic.blogspot.com
--
Cheers,
hamilton verissimo
ham...@castlestronghold.com
http://www.castlestronghold.com/
Guys,
Eager fetching in [ARFetch]: My first real contribution in the last
months, since I've been busy a lot.
The usage is:
public void ShowPosts([ARFetch(Eager = "Posts")] Blog blog) { ... }
It's useful when you know that you'll iterate through a lazy
collection in an specific action, and want to save the database
roundtrip without hacking your mappings.
Ayende,
Can you check the changes on r3723? Is that the best way to perform
eager fetching when loading an object?
I'm pasting the relevant code:
// load using eager fetching of lazy collections
DetachedCriteria criteria = DetachedCriteria.For(type);
criteria.Add(Expression.Eq( pkModel.Property.Name, convertedPk));
foreach (string associationToEagerFetch in attr.Eager.Split(','))
{
string clean = associationToEagerFetch.Trim();
if ( clean.Length == 0)