Scott Millett | 3 Aug 18:25

How to persist an entity when its within a collection of another entity

I have a Customer entity and a Customer has an address book which is a collection of  address entities. When I save a customer I don't really want to be looping through each of his addresses and persisting it to my database.  To save a customer I use this code:~

Dim

aCustomer As Model.Customer

aCustomer = Model.CustomerService.getCustomer(CustomerID)

Model.CustomerService.SaveCustomer(aCustomer)

That all works fine and makes sense. Now if I wanted to Add, Edit or Remove a Customers Address I would use the code:

Dim aCustomer As Model.Customer

aCustomer = Model.CustomerService.getCustomer(CustomerID)

aCustomer.AddressBook(1).PostCode = "PO5 3ED"

Model.CustomerService.SaveCustomerAddress(aCustomer.AddressBook(1))

If this acceptable or should I be able to call simply


Model.CustomerService.SaveCustomer(aCustomer)And have it persist any changes that have been made to the customers address book? And how would I be able to save any changes without having to loop through the entire collection and saving each one individually. I am not using any O/R mapping tools.

Thanks for your help.
Scott


__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___
Greg Young | 3 Aug 21:21
Gravatar

Re: How to persist an entity when its within a collection of another entity

Shouldn't CustomerService be CustomerRepository here?

It sounds like Customer is your aggregate root which means that yes
you should be able to say Model.CustomerRepository.Save(customer) and
it should handle all changes that belong to the customer aggregate.
You mentioned that you are not using an OR mapper, as such you would
have to introduce some of this code yourself.

The general method of doing this is either:
1) Track changes that occur to your domain object with things like
dirty flags/version numbers
2) Keep 2 copies of the graph (one as you loaded it one that you give
back to the caller) then walk the graph when save is called and
compare the two graphs looking for any changes.

These are the two most common ways that OR mappers handle this problem

Cheers,

Greg

On Sun, Aug 3, 2008 at 9:25 AM, Scott Millett <scott <at> elbandit.co.uk> wrote:
> I have a Customer entity and a Customer has an address book which is a
> collection of  address entities. When I save a customer I don't really want
> to be looping through each of his addresses and persisting it to my
> database.  To save a customer I use this code:~
>
> Dim
>
> aCustomer As Model.Customer
>
> aCustomer = Model.CustomerService.getCustomer(CustomerID)
>
> Model.CustomerService.SaveCustomer(aCustomer)
>
> That all works fine and makes sense. Now if I wanted to Add, Edit or Remove
> a Customers Address I would use the code:
>
> Dim aCustomer As Model.Customer
>
> aCustomer = Model.CustomerService.getCustomer(CustomerID)
>
> aCustomer.AddressBook(1).PostCode = "PO5 3ED"
>
> Model.CustomerService.SaveCustomerAddress(aCustomer.AddressBook(1))
>
> If this acceptable or should I be able to call simply
>
> Model.CustomerService.SaveCustomer(aCustomer)And have it persist any changes
> that have been made to the customers address book? And how would I be able
> to save any changes without having to loop through the entire collection and
> saving each one individually. I am not using any O/R mapping tools.
>
> Thanks for your help.
> Scott
>
>
> 

--

-- 
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

------------------------------------

Scott Millett | 3 Aug 22:04

Re: How to persist an entity when its within a collection of another entity

Thanks Greg, 

I think I will go for option 1, I was hesitant about doing this 
because I wasn't sure that my entity would still be focused on the 
business concern. Is this what they call a Domain Model Anti-Pattern?

I have found a great article about this here 
http://www.infoq.com/articles/aspects-of-domain-model-mgmt.

--- In domaindrivendesign <at> yahoogroups.com, "Greg Young" 
<gregoryyoung1@...> wrote:
>
> Shouldn't CustomerService be CustomerRepository here?
> 
> It sounds like Customer is your aggregate root which means that yes
> you should be able to say Model.CustomerRepository.Save(customer) 
and
> it should handle all changes that belong to the customer aggregate.
> You mentioned that you are not using an OR mapper, as such you would
> have to introduce some of this code yourself.
> 
> The general method of doing this is either:
> 1) Track changes that occur to your domain object with things like
> dirty flags/version numbers
> 2) Keep 2 copies of the graph (one as you loaded it one that you 
give
> back to the caller) then walk the graph when save is called and
> compare the two graphs looking for any changes.
> 
> These are the two most common ways that OR mappers handle this 
problem
> 
> Cheers,
> 
> Greg
> 
> On Sun, Aug 3, 2008 at 9:25 AM, Scott Millett <scott@...> wrote:
> > I have a Customer entity and a Customer has an address book which 
is a
> > collection of  address entities. When I save a customer I don't 
really want
> > to be looping through each of his addresses and persisting it to 
my
> > database.  To save a customer I use this code:~
> >
> > Dim
> >
> > aCustomer As Model.Customer
> >
> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
> >
> > Model.CustomerService.SaveCustomer(aCustomer)
> >
> > That all works fine and makes sense. Now if I wanted to Add, Edit 
or Remove
> > a Customers Address I would use the code:
> >
> > Dim aCustomer As Model.Customer
> >
> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
> >
> > aCustomer.AddressBook(1).PostCode = "PO5 3ED"
> >
> > Model.CustomerService.SaveCustomerAddress(aCustomer.AddressBook
(1))
> >
> > If this acceptable or should I be able to call simply
> >
> > Model.CustomerService.SaveCustomer(aCustomer)And have it persist 
any changes
> > that have been made to the customers address book? And how would 
I be able
> > to save any changes without having to loop through the entire 
collection and
> > saving each one individually. I am not using any O/R mapping 
tools.
> >
> > Thanks for your help.
> > Scott
> >
> >
> > 
> 
> 
> 
> -- 
> It is the mark of an educated mind to be able to entertain a thought
> without accepting it.
>

------------------------------------

Greg Young | 3 Aug 22:18
Gravatar

Re: Re: How to persist an entity when its within a collection of another entity

Yes AOP can be used here ... You might want to look at one of the
numerous dynamic proxy generators as a method of handling this (again
this is what many OR mappers already do). Just one point though, if
you are doing all this work might it be easier to just leverage all
the work people have already done on this and just use something like
linq2sql or nhibernate?

Cheers,

Greg

On Sun, Aug 3, 2008 at 1:04 PM, Scott Millett <scott <at> elbandit.co.uk> wrote:
> Thanks Greg,
>
> I think I will go for option 1, I was hesitant about doing this
> because I wasn't sure that my entity would still be focused on the
> business concern. Is this what they call a Domain Model Anti-Pattern?
>
> I have found a great article about this here
> http://www.infoq.com/articles/aspects-of-domain-model-mgmt.
>
> --- In domaindrivendesign <at> yahoogroups.com, "Greg Young"
>
> <gregoryyoung1@...> wrote:
>>
>> Shouldn't CustomerService be CustomerRepository here?
>>
>> It sounds like Customer is your aggregate root which means that yes
>> you should be able to say Model.CustomerRepository.Save(customer)
> and
>> it should handle all changes that belong to the customer aggregate.
>> You mentioned that you are not using an OR mapper, as such you would
>> have to introduce some of this code yourself.
>>
>> The general method of doing this is either:
>> 1) Track changes that occur to your domain object with things like
>> dirty flags/version numbers
>> 2) Keep 2 copies of the graph (one as you loaded it one that you
> give
>> back to the caller) then walk the graph when save is called and
>> compare the two graphs looking for any changes.
>>
>> These are the two most common ways that OR mappers handle this
> problem
>>
>> Cheers,
>>
>> Greg
>>
>> On Sun, Aug 3, 2008 at 9:25 AM, Scott Millett <scott@...> wrote:
>> > I have a Customer entity and a Customer has an address book which
> is a
>> > collection of address entities. When I save a customer I don't
> really want
>> > to be looping through each of his addresses and persisting it to
> my
>> > database. To save a customer I use this code:~
>> >
>> > Dim
>> >
>> > aCustomer As Model.Customer
>> >
>> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
>> >
>> > Model.CustomerService.SaveCustomer(aCustomer)
>> >
>> > That all works fine and makes sense. Now if I wanted to Add, Edit
> or Remove
>> > a Customers Address I would use the code:
>> >
>> > Dim aCustomer As Model.Customer
>> >
>> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
>> >
>> > aCustomer.AddressBook(1).PostCode = "PO5 3ED"
>> >
>> > Model.CustomerService.SaveCustomerAddress(aCustomer.AddressBook
> (1))
>> >
>> > If this acceptable or should I be able to call simply
>> >
>> > Model.CustomerService.SaveCustomer(aCustomer)And have it persist
> any changes
>> > that have been made to the customers address book? And how would
> I be able
>> > to save any changes without having to loop through the entire
> collection and
>> > saving each one individually. I am not using any O/R mapping
> tools.
>> >
>> > Thanks for your help.
>> > Scott
>> >
>> >
>> >
>>
>>
>>
>> --
>> It is the mark of an educated mind to be able to entertain a thought
>> without accepting it.
>>
>
> 

--

-- 
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

------------------------------------

Scott Millett | 3 Aug 22:30

Re: How to persist an entity when its within a collection of another entity

Yes I was going to look at Linq as an O/R Mapper. I was thinking of 
using it to generate objects that are basically tables and then have 
another layer to turn these into my complex domain objects. Do you 
think that this is a good idea?

--- In domaindrivendesign <at> yahoogroups.com, "Greg Young" 
<gregoryyoung1@...> wrote:
>
> Yes AOP can be used here ... You might want to look at one of the
> numerous dynamic proxy generators as a method of handling this 
(again
> this is what many OR mappers already do). Just one point though, if
> you are doing all this work might it be easier to just leverage all
> the work people have already done on this and just use something 
like
> linq2sql or nhibernate?
> 
> Cheers,
> 
> Greg
> 
> On Sun, Aug 3, 2008 at 1:04 PM, Scott Millett <scott@...> wrote:
> > Thanks Greg,
> >
> > I think I will go for option 1, I was hesitant about doing this
> > because I wasn't sure that my entity would still be focused on the
> > business concern. Is this what they call a Domain Model Anti-
Pattern?
> >
> > I have found a great article about this here
> > http://www.infoq.com/articles/aspects-of-domain-model-mgmt.
> >
> > --- In domaindrivendesign <at> yahoogroups.com, "Greg Young"
> >
> > <gregoryyoung1@> wrote:
> >>
> >> Shouldn't CustomerService be CustomerRepository here?
> >>
> >> It sounds like Customer is your aggregate root which means that 
yes
> >> you should be able to say Model.CustomerRepository.Save(customer)
> > and
> >> it should handle all changes that belong to the customer 
aggregate.
> >> You mentioned that you are not using an OR mapper, as such you 
would
> >> have to introduce some of this code yourself.
> >>
> >> The general method of doing this is either:
> >> 1) Track changes that occur to your domain object with things 
like
> >> dirty flags/version numbers
> >> 2) Keep 2 copies of the graph (one as you loaded it one that you
> > give
> >> back to the caller) then walk the graph when save is called and
> >> compare the two graphs looking for any changes.
> >>
> >> These are the two most common ways that OR mappers handle this
> > problem
> >>
> >> Cheers,
> >>
> >> Greg
> >>
> >> On Sun, Aug 3, 2008 at 9:25 AM, Scott Millett <scott@> wrote:
> >> > I have a Customer entity and a Customer has an address book 
which
> > is a
> >> > collection of address entities. When I save a customer I don't
> > really want
> >> > to be looping through each of his addresses and persisting it 
to
> > my
> >> > database. To save a customer I use this code:~
> >> >
> >> > Dim
> >> >
> >> > aCustomer As Model.Customer
> >> >
> >> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
> >> >
> >> > Model.CustomerService.SaveCustomer(aCustomer)
> >> >
> >> > That all works fine and makes sense. Now if I wanted to Add, 
Edit
> > or Remove
> >> > a Customers Address I would use the code:
> >> >
> >> > Dim aCustomer As Model.Customer
> >> >
> >> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
> >> >
> >> > aCustomer.AddressBook(1).PostCode = "PO5 3ED"
> >> >
> >> > Model.CustomerService.SaveCustomerAddress(aCustomer.AddressBook
> > (1))
> >> >
> >> > If this acceptable or should I be able to call simply
> >> >
> >> > Model.CustomerService.SaveCustomer(aCustomer)And have it 
persist
> > any changes
> >> > that have been made to the customers address book? And how 
would
> > I be able
> >> > to save any changes without having to loop through the entire
> > collection and
> >> > saving each one individually. I am not using any O/R mapping
> > tools.
> >> >
> >> > Thanks for your help.
> >> > Scott
> >> >
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> It is the mark of an educated mind to be able to entertain a 
thought
> >> without accepting it.
> >>
> >
> > 
> 
> 
> 
> -- 
> It is the mark of an educated mind to be able to entertain a thought
> without accepting it.
>

------------------------------------

Greg Young | 4 Aug 00:48
Gravatar

Re: Re: How to persist an entity when its within a collection of another entity

That will work fine ... you can use the linq objects as DAOs. You may
however want to at least research nhibernate as it supports many more
complex mappings (many even use nhibernate straight into their
domain). Personally I am not a fan of an OR mapper going directly to
domain objects (mainly because persistence ignorance is still
non-existent with any product I have used) but many have done so and
been very effective.

Cheers,

Greg

On Sun, Aug 3, 2008 at 1:30 PM, Scott Millett <scott <at> elbandit.co.uk> wrote:
> Yes I was going to look at Linq as an O/R Mapper. I was thinking of
> using it to generate objects that are basically tables and then have
> another layer to turn these into my complex domain objects. Do you
> think that this is a good idea?
>
> --- In domaindrivendesign <at> yahoogroups.com, "Greg Young"
> <gregoryyoung1@...> wrote:
>>
>> Yes AOP can be used here ... You might want to look at one of the
>> numerous dynamic proxy generators as a method of handling this
> (again
>> this is what many OR mappers already do). Just one point though, if
>> you are doing all this work might it be easier to just leverage all
>> the work people have already done on this and just use something
> like
>> linq2sql or nhibernate?
>>
>> Cheers,
>>
>> Greg
>>
>> On Sun, Aug 3, 2008 at 1:04 PM, Scott Millett <scott@...> wrote:
>> > Thanks Greg,
>> >
>> > I think I will go for option 1, I was hesitant about doing this
>> > because I wasn't sure that my entity would still be focused on the
>> > business concern. Is this what they call a Domain Model Anti-
> Pattern?
>> >
>> > I have found a great article about this here
>> > http://www.infoq.com/articles/aspects-of-domain-model-mgmt.
>> >
>> > --- In domaindrivendesign <at> yahoogroups.com, "Greg Young"
>> >
>> > <gregoryyoung1@> wrote:
>> >>
>> >> Shouldn't CustomerService be CustomerRepository here?
>> >>
>> >> It sounds like Customer is your aggregate root which means that
> yes
>> >> you should be able to say Model.CustomerRepository.Save(customer)
>> > and
>> >> it should handle all changes that belong to the customer
> aggregate.
>> >> You mentioned that you are not using an OR mapper, as such you
> would
>> >> have to introduce some of this code yourself.
>> >>
>> >> The general method of doing this is either:
>> >> 1) Track changes that occur to your domain object with things
> like
>> >> dirty flags/version numbers
>> >> 2) Keep 2 copies of the graph (one as you loaded it one that you
>> > give
>> >> back to the caller) then walk the graph when save is called and
>> >> compare the two graphs looking for any changes.
>> >>
>> >> These are the two most common ways that OR mappers handle this
>> > problem
>> >>
>> >> Cheers,
>> >>
>> >> Greg
>> >>
>> >> On Sun, Aug 3, 2008 at 9:25 AM, Scott Millett <scott@> wrote:
>> >> > I have a Customer entity and a Customer has an address book
> which
>> > is a
>> >> > collection of address entities. When I save a customer I don't
>> > really want
>> >> > to be looping through each of his addresses and persisting it
> to
>> > my
>> >> > database. To save a customer I use this code:~
>> >> >
>> >> > Dim
>> >> >
>> >> > aCustomer As Model.Customer
>> >> >
>> >> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
>> >> >
>> >> > Model.CustomerService.SaveCustomer(aCustomer)
>> >> >
>> >> > That all works fine and makes sense. Now if I wanted to Add,
> Edit
>> > or Remove
>> >> > a Customers Address I would use the code:
>> >> >
>> >> > Dim aCustomer As Model.Customer
>> >> >
>> >> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
>> >> >
>> >> > aCustomer.AddressBook(1).PostCode = "PO5 3ED"
>> >> >
>> >> > Model.CustomerService.SaveCustomerAddress(aCustomer.AddressBook
>> > (1))
>> >> >
>> >> > If this acceptable or should I be able to call simply
>> >> >
>> >> > Model.CustomerService.SaveCustomer(aCustomer)And have it
> persist
>> > any changes
>> >> > that have been made to the customers address book? And how
> would
>> > I be able
>> >> > to save any changes without having to loop through the entire
>> > collection and
>> >> > saving each one individually. I am not using any O/R mapping
>> > tools.
>> >> >
>> >> > Thanks for your help.
>> >> > Scott
>> >> >
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> It is the mark of an educated mind to be able to entertain a
> thought
>> >> without accepting it.
>> >>
>> >
>> >
>>
>>
>>
>> --
>> It is the mark of an educated mind to be able to entertain a thought
>> without accepting it.
>>
>
> 

--

-- 
It is the mark of an educated mind to be able to entertain a thought
without accepting it.

------------------------------------

Scott Millett | 4 Aug 08:58

Re: How to persist an entity when its within a collection of another entity

Cheers Greg I will check nhibernate out as well.

--- In domaindrivendesign <at> yahoogroups.com, "Greg Young" 
<gregoryyoung1@...> wrote:
>
> That will work fine ... you can use the linq objects as DAOs. You 
may
> however want to at least research nhibernate as it supports many 
more
> complex mappings (many even use nhibernate straight into their
> domain). Personally I am not a fan of an OR mapper going directly to
> domain objects (mainly because persistence ignorance is still
> non-existent with any product I have used) but many have done so and
> been very effective.
> 
> Cheers,
> 
> Greg
> 
> On Sun, Aug 3, 2008 at 1:30 PM, Scott Millett <scott@...> wrote:
> > Yes I was going to look at Linq as an O/R Mapper. I was thinking 
of
> > using it to generate objects that are basically tables and then 
have
> > another layer to turn these into my complex domain objects. Do you
> > think that this is a good idea?
> >
> > --- In domaindrivendesign <at> yahoogroups.com, "Greg Young"
> > <gregoryyoung1@> wrote:
> >>
> >> Yes AOP can be used here ... You might want to look at one of the
> >> numerous dynamic proxy generators as a method of handling this
> > (again
> >> this is what many OR mappers already do). Just one point though, 
if
> >> you are doing all this work might it be easier to just leverage 
all
> >> the work people have already done on this and just use something
> > like
> >> linq2sql or nhibernate?
> >>
> >> Cheers,
> >>
> >> Greg
> >>
> >> On Sun, Aug 3, 2008 at 1:04 PM, Scott Millett <scott@> wrote:
> >> > Thanks Greg,
> >> >
> >> > I think I will go for option 1, I was hesitant about doing this
> >> > because I wasn't sure that my entity would still be focused on 
the
> >> > business concern. Is this what they call a Domain Model Anti-
> > Pattern?
> >> >
> >> > I have found a great article about this here
> >> > http://www.infoq.com/articles/aspects-of-domain-model-mgmt.
> >> >
> >> > --- In domaindrivendesign <at> yahoogroups.com, "Greg Young"
> >> >
> >> > <gregoryyoung1@> wrote:
> >> >>
> >> >> Shouldn't CustomerService be CustomerRepository here?
> >> >>
> >> >> It sounds like Customer is your aggregate root which means 
that
> > yes
> >> >> you should be able to say Model.CustomerRepository.Save
(customer)
> >> > and
> >> >> it should handle all changes that belong to the customer
> > aggregate.
> >> >> You mentioned that you are not using an OR mapper, as such you
> > would
> >> >> have to introduce some of this code yourself.
> >> >>
> >> >> The general method of doing this is either:
> >> >> 1) Track changes that occur to your domain object with things
> > like
> >> >> dirty flags/version numbers
> >> >> 2) Keep 2 copies of the graph (one as you loaded it one that 
you
> >> > give
> >> >> back to the caller) then walk the graph when save is called 
and
> >> >> compare the two graphs looking for any changes.
> >> >>
> >> >> These are the two most common ways that OR mappers handle this
> >> > problem
> >> >>
> >> >> Cheers,
> >> >>
> >> >> Greg
> >> >>
> >> >> On Sun, Aug 3, 2008 at 9:25 AM, Scott Millett <scott@> wrote:
> >> >> > I have a Customer entity and a Customer has an address book
> > which
> >> > is a
> >> >> > collection of address entities. When I save a customer I 
don't
> >> > really want
> >> >> > to be looping through each of his addresses and persisting 
it
> > to
> >> > my
> >> >> > database. To save a customer I use this code:~
> >> >> >
> >> >> > Dim
> >> >> >
> >> >> > aCustomer As Model.Customer
> >> >> >
> >> >> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
> >> >> >
> >> >> > Model.CustomerService.SaveCustomer(aCustomer)
> >> >> >
> >> >> > That all works fine and makes sense. Now if I wanted to Add,
> > Edit
> >> > or Remove
> >> >> > a Customers Address I would use the code:
> >> >> >
> >> >> > Dim aCustomer As Model.Customer
> >> >> >
> >> >> > aCustomer = Model.CustomerService.getCustomer(CustomerID)
> >> >> >
> >> >> > aCustomer.AddressBook(1).PostCode = "PO5 3ED"
> >> >> >
> >> >> > Model.CustomerService.SaveCustomerAddress
(aCustomer.AddressBook
> >> > (1))
> >> >> >
> >> >> > If this acceptable or should I be able to call simply
> >> >> >
> >> >> > Model.CustomerService.SaveCustomer(aCustomer)And have it
> > persist
> >> > any changes
> >> >> > that have been made to the customers address book? And how
> > would
> >> > I be able
> >> >> > to save any changes without having to loop through the 
entire
> >> > collection and
> >> >> > saving each one individually. I am not using any O/R mapping
> >> > tools.
> >> >> >
> >> >> > Thanks for your help.
> >> >> > Scott
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> It is the mark of an educated mind to be able to entertain a
> > thought
> >> >> without accepting it.
> >> >>
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> It is the mark of an educated mind to be able to entertain a 
thought
> >> without accepting it.
> >>
> >
> > 
> 
> 
> 
> -- 
> It is the mark of an educated mind to be able to entertain a thought
> without accepting it.
>

------------------------------------

moffdub | 4 Aug 12:19
Favicon

Re: How to persist an entity when its within a collection of another entity

I concur with most of what has been said in this thread re: dirty
flags and such. As for the concern of making one call per address
object, you can design the address repository to take a list of
address objects and construct one SQL string that updates all of them
at once so you only make one trip to the DB.

--- In domaindrivendesign <at> yahoogroups.com, "Scott Millett" <scott@...>
wrote:
>
> I have a Customer entity and a Customer has an address book which is a
> collection of  address entities. When I save a customer I don't really
> want to be looping through each of his addresses and persisting it to my
> database.  To save a customer I use this code:~
> 
> 
> Dim aCustomer As Model.Customer
> 
> aCustomer = Model.CustomerService.getCustomer(CustomerID)
> 
> 
> 
> Model.CustomerService.SaveCustomer(aCustomer)
> 
> 
> That all works fine and makes sense. Now if I wanted to Add, Edit or
> Remove a Customers Address I would use the code:
> 
> Dim aCustomer As Model.Customer
> 
> aCustomer = Model.CustomerService.getCustomer(CustomerID)
> 
> aCustomer.AddressBook(1).PostCode = "PO5 3ED"
> 
> Model.CustomerService.SaveCustomerAddress(aCustomer.AddressBook(1))
> 
> If this acceptable or should I be able to call simply
> 
> Model.CustomerService.SaveCustomer(aCustomer)
> And have it persist any changes that have been made to the customers
> address book? And how would I be able to save any changes without having
> to loop through the entire collection and saving each one individually.
> I am not using any O/R mapping tools.
> 
> Thanks for your help.
> Scott
>

------------------------------------


Gmane