Пример #1
0
        protected void ProduceNestedProperties(string instanceName, object instance, GenerationContext context)
        {
            foreach (var propertyInfo in Meta.NestedProperties)
            {
                if (!Meta.IsDefault(propertyInfo, instance))
                {
                    var generator = _tgr.GetGeneratorFor(propertyInfo.PropertyType);
                    var value     = Meta.Value(propertyInfo, instance);
                    generator.New(value, context);
                    var varName = context.GetDefined(value);
                    var ae      = SafeAssignment(instanceName, propertyInfo.Name, IdentifierName(varName));

                    context.LateBound.Enqueue(ExpressionStatement(ae));
                    context.AddUsing(propertyInfo.PropertyType.Namespace);
                }
            }
        }