Sending full blown entities across the wire might cause you problems down the road, specially with lazy loading. In your case, if what the client is sending back, is 1:1 with the domain model, you can call the ISession.Update() and NH will realize it is a detached instance and will try to reconcile any changes. I'm assuming your session has a per call lifecycle.
On Jun 11, 11:21 am, bearrito <[email protected]> wrote: > My question is the following: > > I am using Nhibernate in a repository pattern. > I query my repository to retrieve my objects. > > These object are all decorated with DataContract or DataMember > attributes in order to be serialized. > > I will then pass these objects to a wcf service. The serialization > takes place and the objects are passed over the wire. On the client > side the objects are deserialized and cast into a DTO/Model view. > > These DTO's are displayed to the user, the user can make changes and > save the results. > As expected the process is reversed and the object is sent back over > the wire. > > My confusion is how to save the detached object. When it comes back > over the wire I assume it is a "new object". > > Should I update or save in the same session? > Create a new session and merge. > > For what it is worth I am using this repository pattern > :http://daniel.wertheim.se/tag/nhibernate/ > > I think some of my confusion maybe related to session/instance mgmt. > so don't assume I know what you are talking about when it comes to > these. -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
