Ignore child properties in update

73 views
Skip to first unread message

Matteo Migliore

unread,
May 20, 2013, 12:52:23 PM5/20/13
to nhibernate-...@googlegroups.com
Hi,

is possible to ignore the child properties during an update of the entity?

I would update only the reference but not its properties.

E.g.
class Order
{
    User User { get; set; }
}

When I update the Order I would change the User that placed it but not its properties (Name etc...)

Thanks,
Matteo

Ricardo Peres

unread,
May 21, 2013, 4:51:40 AM5/21/13
to nhibernate-...@googlegroups.com
The proper list to ask these questions is nhusers. In this case, if I understand you correctly, you want to change the User to a different one, but not update its properties, right? I think you can call ISession.SetReadOnly on the User instance.

RP

Matteo Migliore

unread,
May 21, 2013, 6:21:29 AM5/21/13
to nhibernate-...@googlegroups.com
Ok, sorry Ricardo, you're right, I will post on the other group, but is not possible to use ISession.SetReadOnly on a child property.

Thanks,
Matteo

--
 
---
You received this message because you are subscribed to a topic in the Google Groups "nhibernate-development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nhibernate-development/0uApqvT2SLw/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ricardo Peres

unread,
May 21, 2013, 7:42:01 AM5/21/13
to nhibernate-...@googlegroups.com
Of course it is:

Order o = ...;

session.SetReadOnly(o.User, true);
To unsubscribe from this group and all its topics, send an email to nhibernate-development+unsub...@googlegroups.com.

Matteo Migliore

unread,
May 21, 2013, 7:47:38 AM5/21/13
to nhibernate-...@googlegroups.com
Is not better to continue the discussion on the correct group? :)
To unsubscribe from this group and all its topics, send an email to nhibernate-develo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages