Then why do have the BlogId property in there? Simply discard it.

-Markus

2009/1/12 Mark Jensen <[email protected]>:
>
> haven't tested it yet, but is it really required to make it
> bidirectional for this to work ?
>
> because I only need it to go one way :/
>
> On Jan 10, 2:41 pm, "Markus Zywitza" <[email protected]> wrote:
>> > public class Post : BaseEntity<Post>
>> > {
>> >    [Property("BlogId", NotNull = true)]
>> >    public Guid BlogId
>> >    {
>> >        get { return blogId; }
>> >        set { blogId = value; }
>> >    }
>>
>> [BelongsTo("BlogId")]
>> public Blog Blog {get; set;}
>>
>> > }
>> >> > anyway...it is not the ID on Post that is the problem.. it is the
>> >> > BlogID on Post that is empty after I persist Blog with Blog.Save().
>>
>> Of course, it is changed in the DB but not in the object. Call
>> post.Refresh() to reload it. If you implement it as I have written
>> above, you could also set Blog on the post instance instead.
>>
>>        public void AddPost(Post post)
>>        {
>>                posts.Add(post);
>>                post.Blog=this;
>>        }
>>
>> -Markus
> >
>

--~--~---------~--~----~------------~-------~--~----~
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