So I have done some more experimentation. It seems that *all* properties 
that are set inside the constructor, are set to null (if applicable).

Is there a way to set properties inside the constructor of the entities 
when using NHibernate?

On Wednesday, November 14, 2012 11:23:50 PM UTC+2, Mike B wrote:
>
> I have these classes:
>
> ParentEntity : ISomeInterface
> {
>    public ParentEntity()
>    {
>           ComplexProperty  = new ComplexProperty { ParentEntityReference = 
> this };
>     }
>    int ID {get; set;}
>    ComplexProperty ComplexProperty {get; set;}
> }
>
> ComplexProperty
> {
>    int ComplexPropertyID {get; set;}
>    ISomeInterface ParentEntityReference {get; set;}
> }
>
> Mapping is one way, meaning thet ParentEntity has a "HasMany()" mapping 
> and that's it.
>
> While working with POCOs, everything is fine. I get the parent class, and 
> the child has a reference to the parent. When I retrieve the ParentEntity 
> object from the ORM though, The property: 
> ParentEntity.ComplexProperty.ParentEntityReference == null ! Any Idea how I 
> get around this? And how to handle one way mappings in general? All I need 
> is a reference to the parent object inside the ComplexProperty
>

-- 
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/-/wV7gFSWxnyIJ.
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