Use a new class that contains only the properties you want to return to the user, and project into that, e.g. using .select() with NH linq. The new class should not be a subclass of any database entity, so NH will not try to manage it. Then you can change whatever properties you want, since the new object isn't an entity.
On Mon, Apr 20, 2015, 3:30 AM Shahbaz Chishty <chishtyshah...@gmail.com> wrote: > What I actually want to do is just edit the values after I get all the > data from my nHibernate query. So I would just update my changes to the > collection I have and return it to the user. I've also tried detaching the > object but it works the same. > > On Monday, April 20, 2015 at 11:50:03 AM UTC+5:30, Carl B wrote: > >> You probably need to define a class for the relationship, like AB, put >> the property on the relationship, then use HasMany to/from the relationship >> class. Your example is a little abstract, though. >> >> Since you want to change a property but not have it affect the other As >> that have the same B, it can't be a property of B, since by definition, any >> A with that B would have the same properties on that B. >> >> On Mon, Apr 20, 2015, 1:50 AM Shahbaz Chishty <chishty...@gmail.com> >> wrote: >> > I have two entities that have hasManyToMany association between them. i.e. >>> each of the entity has a collection of the other. >>> >>> For example, I have entities A and B, So A will have a collection of B >>> in it. Now when I read A, it will also read the ICollection(). So in this >>> collection, I want to set the value of a primitive field, different for >>> each A object. But when I do so, my changes to B are passed to other A >>> objects using the same B object. >>> >>> I just want to overwrite the data in the child collection. But when i do >>> it, the child object gets overwritten for every parent the uses it. >>> >>> Any suggestions on that? >>> >>> I hope I'm pretty clear what i need to do, but I'm open for a discussion >>> on this. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Fluent NHibernate" group. >>> >> To unsubscribe from this group and stop receiving emails from it, send an >>> email to fluent-nhibern...@googlegroups.com. >>> To post to this group, send email to fluent-n...@googlegroups.com. >> >> >>> Visit this group at http://groups.google.com/group/fluent-nhibernate. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > You received this message because you are subscribed to the Google Groups > "Fluent NHibernate" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to fluent-nhibernate+unsubscr...@googlegroups.com. > To post to this group, send email to fluent-nhibernate@googlegroups.com. > Visit this group at http://groups.google.com/group/fluent-nhibernate. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To unsubscribe from this group and stop receiving emails from it, send an email to fluent-nhibernate+unsubscr...@googlegroups.com. To post to this group, send email to fluent-nhibernate@googlegroups.com. Visit this group at http://groups.google.com/group/fluent-nhibernate. For more options, visit https://groups.google.com/d/optout.