示例#1
0
        public void CreateSimplePropertySetter()
        {
            var labelNoChange = Generator.DefineLabel();

            EmitHelpers.GenerateJumpIfEqual(Generator, PropertyInfo.PropertyType, labelNoChange,
                                            g => g.Ldarg(0).Ldfld(DefaultFieldBuilder),
                                            g => g.Ldarg(1));
            Generator
            .Ldarg(0)
            .Ldarg(1)
            .Stfld(DefaultFieldBuilder);
            CallObjectModified(Generator);
            Generator.Mark(labelNoChange);
        }
示例#2
0
        public void CreatePropertySetter(FieldHandlerCreateImpl ctx)
        {
            var ilGenerator   = ctx.Generator;
            var fieldBuilder  = ctx.DefaultFieldBuilder;
            var labelNoChange = ilGenerator.DefineLabel();

            ilGenerator.DeclareLocal(typeof(ulong));
            ilGenerator
            .Ldarg(0)
            .Ldfld(ctx.FieldMidLevelDBTransaction)
            .Ldarg(1)
            .Callvirt(() => ((IObjectDBTransactionInternal)null).GetOid(null))
            .Stloc(0);
            EmitHelpers.GenerateJumpIfEqual(ilGenerator, typeof(ulong), labelNoChange,
                                            g => g.Ldarg(0).Ldfld(fieldBuilder),
                                            g => g.Ldloc(0));
            ilGenerator
            .Ldarg(0)
            .Ldloc(0)
            .Stfld(fieldBuilder);
            ctx.CallObjectModified(ilGenerator);
            ilGenerator
            .Mark(labelNoChange);
        }