Thanks for your reply Diego.
Right, cloning. I thought maybe there was an easier way.
I've learned that if I call session.Clear() before session.Save() I
get the results I want.
However, the problem is when I have objects with "deeper" stuff.
For example,
WebpageDataProvider provider = new WebpageDataProvider(session);
Webpage p = provider.GetById(1);
p.Audit = new Audit();
CultureInfo i = new CultureInfo("en-us");
p.Title.Translations[i.LCID].Text = "testing";
session.Clear();
session.Save(p);
I get a new Webpage object inserted as desired, but I also want the
p.Title object (which is a whole other bunch of stuff starting with a
Translation object then having multiple TranslationValue objects
associated).
Is cloning still the best way to go about this?
Also, do you have any ideas about how to implement the cloning? Would
that go into my data provider layer? How do I ensure I clone as deep
as I need (maybe by using attributes?)?
Thanks so much for your help and expert insight!
On Mar 4, 2:57 pm, Diego Mijelshon <[email protected]> wrote:
> Clone it. As far as NH is concerned, you are effectively creating a new
> instance
>
> Diego
>
>
>
> On Thu, Mar 4, 2010 at 16:32, nicklang <[email protected]> wrote:
> > Hi!
>
> > I want to GET an object, modify it then save - but I want it to be
> > INSERTED - not updated. The object would have a new generated ID and
> > everything. (This is to help with versioning/auditing my objects).
>
> > Thanks for your insights!
>
> > --
> > 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]<nhusers%[email protected]
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
--
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.