On Sat, Sep 19, 2009 at 1:18 PM, SteamAnger <[email protected]> wrote:
>
> See code below (from the AR tutorial)
>
> ----------------------------------------------
>
> currentPost.Blog = parentBlog;
> currentPost.Title = titleText.Text;
> currentPost.Contents = contentsText.Text;
> currentPost.Category = categoryText.Text;
> currentPost.Created = createdDtTime.Value;
> currentPost.Published = publishedCheck.Checked;
>
> currentPost.Save();
>
> ----------------------------------------------
>
> In this code I must load the whole object parentBlog to save this
> post. But the only thing I need actually is the Id of the blog.
>
> Is it possible to avoid to load the whole blog object?

Yes.  This explains how NHibernate can do this:

http://ayende.com/Blog/archive/2009/04/30/nhibernate-ndash-the-difference-between-get-load-and-querying-by.aspx

And for ActiveRecord, just remember that:

Session.Load == ActiveRecordBase.Find
Session.Get == ActiveRecordBase.TryFind

-- 
Patrick Steele
http://weblogs.asp.net/psteele

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to