ObjectHydrator icon indicating copy to clipboard operation
ObjectHydrator copied to clipboard

Nested Object.

Open mikila85 opened this issue 9 years ago • 3 comments

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.

mikila85 avatar Aug 19 '15 14:08 mikila85

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)));

mikila85 avatar Aug 20 '15 07:08 mikila85

Does this work?

var hydrator = new Hydrator<Record>() .With(x => x.Person, new TypeGenerator<Person>()); var _record = hydrator.GetSingle();

PrintsCharming avatar Aug 20 '15 14:08 PrintsCharming

shouldn't this be made "automagically"? some classes have lots of children and grandchildren

geomorillo avatar Aug 12 '20 13:08 geomorillo