I wouldmake a call on save for Customer, and it iwll cascade.

Tuna Toksöz
Eternal sunshine of the open source mind.

http://devlicio.us/blogs/tuna_toksoz
http://tunatoksoz.com
http://twitter.com/tehlike




On Fri, Sep 11, 2009 at 9:50 AM, Topflysecurity <konnektgra...@gmail.com>wrote:

>
> so if i got this right i cant do a Customer.AddCustomerPhone().. i
> have to do call my CustomerPhoneService and save the CustomerPhone
> like that?
>
> On 11 Sep, 15:43, Tuna Toksoz <tehl...@gmail.com> wrote:
> > You have to issue a call to session.Save() and save the root.
> >
> > Tuna Toksöz
> > Eternal sunshine of the open source mind.
> >
> >
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitter.com/tehlike
> >
> > On Fri, Sep 11, 2009 at 9:41 AM, Topflysecurity <konnektgra...@gmail.com
> >wrote:
> >
> >
> >
> > > Yes it is. what can i do?
> >
> > > On 11 Sep, 15:39, Tuna Toksoz <tehl...@gmail.com> wrote:
> > > > Is "CustomerPhones" an IList<CustomerPhone>?
> >
> > > > Tuna Toksöz
> > > > Eternal sunshine of the open source mind.
> >
> > >http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt.
> ..
> >
> > > > On Fri, Sep 11, 2009 at 9:34 AM, Topflysecurity <
> konnektgra...@gmail.com
> > > >wrote:
> >
> > > > > i am sorry but what you mean with "not persisting it into DB " in
> this
> > > > > case?
> >
> > > > > On 11 Sep, 15:24, Tuna Toksoz <tehl...@gmail.com> wrote:
> > > > > > You're not persisting it into DB
> >
> > > > > > Tuna Toksöz
> > > > > > Eternal sunshine of the open source mind.
> >
> > > > >
> http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt.
> > > ..
> >
> > > > > > On Fri, Sep 11, 2009 at 9:23 AM, Topflysecurity <
> > > konnektgra...@gmail.com
> > > > > >wrote:
> >
> > > > > > > hi. i wonder what i am missing. let's say i got a Customer and
> i
> > > add a
> > > > > > > CustomerPhone, when i try to use the CustomerPhone id right
> after
> > > the
> > > > > > > save it is 0. i really haven't had this problem before and i
> don't
> > > > > > > know what to search for on google. so i give it a shot here
> >
> > > > > > > public virtual void AddCustomerPhones(CustomerPhone
> customerPhone)
> > > > > > >        {
> > > > > > >            customerPhone.Customer = this;
> > > > > > >            CustomerPhones.Add(customerPhone);
> > > > > > >        }
> >
> > > > > > >  public CustomerMap()
> > > > > > >        {
> > > > > > >            Id(x => x.Id,
> > > "Id").GeneratedBy.Identity().WithUnsavedValue
> > > > > > > (default(int));
> >
> > > > > > >            Map(x => x.Name);
> > > > > > >            Map(x => x.CreateDate);
> > > > > > >            Map(x => x.Active);
> > > > > > >            Map(x => x.OrgNumber);
> > > > > > >            Map(x => x.Email);
> > > > > > >            Map(x => x.CGuid);
> >
> > > > > > >            HasMany<CustomerPhone>(x =>
> x.CustomerPhones).IsInverse
> > > > > > > ().Cascade.All().LazyLoad();
> > > > > > >        }
> >
> > > > > > > public CustomerPhoneMap()
> > > > > > >        {
> > > > > > >            Id(x => x.Id,
> > > "Id").GeneratedBy.Identity().WithUnsavedValue
> > > > > > > (default(int));
> >
> > > > > > >            Map(x => x.Name);
> > > > > > >            Map(x => x.Phone);
> >
> > > > > > >            References(x => x.Customer);
> > > > > > >        }
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to