BTDB.EventStore2Layer.EventSerializer.BuildNestedObjGatherer C# (CSharp) Метод

BuildNestedObjGatherer() приватный Метод

private BuildNestedObjGatherer ( ITypeDescriptor descriptor, Type type ) : IDescriptorSerializerLiteContext>.Action
descriptor ITypeDescriptor
type System.Type
Результат IDescriptorSerializerLiteContext>.Action
        Action<object, IDescriptorSerializerLiteContext> BuildNestedObjGatherer(ITypeDescriptor descriptor, Type type)
        {
            Action<object, IDescriptorSerializerLiteContext> res;
            if (type != null)
            {
                if (_gathererCache.TryGetValue(type, out res))
                    return res;
            }
            var gen = descriptor.BuildNewDescriptorGenerator();
            if (gen == null)
            {
                res = (obj, ctx) => { };
            }
            else
            {
                var method = ILBuilder.Instance.NewMethod<Action<object, IDescriptorSerializerLiteContext>>("GatherAllObjectsForTypeExtraction_" + descriptor.Name);
                var il = method.Generator;
                gen.GenerateTypeIterator(il, ilgen => ilgen.Ldarg(0), ilgen => ilgen.Ldarg(1), type);
                il.Ret();
                res = method.Create();
            }
            if (type != null) _gathererCache[type] = res;
            return res;
        }