Hi guys,

This is the models:

public class BlogPost {
    public virtual int Id { get; set; }
    public virtual IList<Comment> Comments { get; set; }
}

public class Comment {
    public virtual int Id { get; set; }
    public virtual string Content { get; set; }

    // public virtual BlogPost BlogPost { get; set; }
}

Notice the commented line above. 

I do *NOT *want the bidirectional association between BlogPost and Comment. 
I want BlogPost to have a Comments collection, but do not want Comment to 
have a reference back to BlogPost.

As far as I know, this requires the mapping of Comments collection to be 
*inverse 
= "false"*, and this requires the foreign key (BlogPostId) in the Comment 
table to be *nullable*. But from the database modeling's point of view, the 
foreign key BlogPostId should be not-null.

So, I want the foreign key BlogPostId in the Comment table to be not-null, 
while still keeping the association unidirectional, that is, remove the 
BlogPost property from Comment class. Can I do that? Thanks

*BTW*: Could anyone who is the manager of this group add me to the group? 
Now I can't publish posts without your verification. :-( Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/YtUwXfvJa7kJ.
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/nhusers?hl=en.

Reply via email to