示例#1
0
        private object BuildDelegate <T>(MetadataForModel metadata)
        {
            var dynamicMethod = GetDynamicMethod <T>();

            using (var il = new GroboIL(dynamicMethod))
            {
                il.Ldarg(0);
                il.Callnonvirt(GetStartRowMethod());

                foreach (var emitInfo in metadata.EmitInfos)
                {
                    il.Ldarg(0);
                    il.Ldarg(1);
                    il.Callnonvirt(emitInfo.Getter);
                    if (emitInfo.PostgresType != null)
                    {
                        il.Ldc_I4((int)emitInfo.PostgresType.Value);
                    }
                    il.Callnonvirt(emitInfo.WriteMethod);
                }

                il.Ret();
            }

            return(dynamicMethod.CreateDelegate(typeof(Action <NpgsqlBinaryImporter, T>)));
        }
示例#2
0
 private void EmitDictItemSet(GroboIL il)
 {
     il.Callnonvirt(_dictSetItemMethod);
 }