Esempio n. 1
0
        public MethodBuilder BuildMethodContext(MethodBuilder builder, ServiceActionBuildContext context, Action <ServiceActionBuildContext, ILGenerator> action)
        {
            var il = builder.GetILGenerator();

            action.Invoke(context, il);
            return(builder);
        }
Esempio n. 2
0
        public void Build(TypeBuilder builder, ServiceActionBuildContext context)
        {
            var paramTypes    = context.ActionModel.Parameters.OrderBy(f => f.Position).Select(f => f.ParameterType).ToArray();
            var methodBuilder = builder.DefineMethod(context.ActionModel.ActionName, MethodAttributes.Public, context.ActionModel.ReturnType, paramTypes);

            this.BuildAction(methodBuilder, context);
        }
Esempio n. 3
0
        public void BuildAction(MethodBuilder builder, ServiceActionBuildContext context)
        {
            var actionModel = context.ActionModel;

            this.BuildParameter(builder, actionModel);
            this.BuildAttribute(builder, actionModel.Attributes);
            this.BuildMethodContext(builder, context, actionModel.GeneratActionIL);
        }