1

Closed

Aggregate Roots

description

Would be cool if say your Customer object had an IList<CustomerAddress> Addresses you could this...
Hydrator<Customer> hydrator=new Hydrator<Customer>()
.WithHydrator("Addresses", new Hydrator<CustomerAddress>().CountOf(5));
 
Been tryng to think of how to make that happen without tearing a hole in the fabric of the space-time continuum.
Closed Oct 12, 2009 at 8:31 PM by Webjedi

comments

ScottMonnig wrote Oct 9, 2009 at 4:47 AM

Very cool idea! The code I sent your way included some stuff (maybe commented out) that would populate a single child instance. I would think we could also pretty easily just call .GetList(5) somewhere down in there... I didn't take it too far because my head started hurting when I thought about passing instantiation parameters in for the child lists.

My approach was something like:
.WithChildEntity("Addresses", typeof(CustomerAddress));

Note down in the TypeGenerator there was a Reflection based call to GetSingle. A Call there to GetList(5) would then do what you want I think.

Webjedi wrote Oct 9, 2009 at 3:55 PM

I like it!

I tweaked the GetList function a little...now a value of 0 will return a list of random length 1-10. Typing this I wonder if I should change GetList to GetFixedSizedList and create another method of GetList that chains down to GetFixedSizedList with a random value based on a min/max parameter.

wrote Oct 12, 2009 at 8:31 PM

wrote Feb 13, 2013 at 5:37 PM

wrote May 15, 2013 at 11:55 PM