ObjectHydrator
ObjectHydrator copied to clipboard
Nested Object.
I have an object which is nested:
Record:
String email;
Person person;
Person:
String FirstName;
the email gets generated but the FirstName inside the Person remains Null.
any help i can get with that please.
i just need to pass the object or the type as (where "OBJECT"):
Add(new Map() .Matching(info => { DataTypeAttribute hydratorType = info.GetCustomAttributes(typeof(DataTypeAttribute), false).Cast ().FirstOrDefault(); return hydratorType != null && hydratorType.Kind == "Child"; }) .Using(new ChildGenerator(OBJECT)));
Does this work?
var hydrator = new Hydrator<Record>() .With(x => x.Person, new TypeGenerator<Person>()); var _record = hydrator.GetSingle();
shouldn't this be made "automagically"? some classes have lots of children and grandchildren