public void BuildAttribute(TypeBuilder builder, IList <Attribute> attributes) { foreach (var attribute in attributes) { var customAttributeBuilder = CustomAttributeBuilderFactory.Build(attribute); if (customAttributeBuilder != null) { builder.SetCustomAttribute(customAttributeBuilder); } } }
public MethodBuilder BuildAttribute(MethodBuilder builder, IList <Attribute> attributes) { foreach (var attribute in attributes) { var customAttributeBuilder = CustomAttributeBuilderFactory.Build(attribute); if (customAttributeBuilder != null) { builder.SetCustomAttribute(customAttributeBuilder); } } return(builder); }
public MethodBuilder BuildParameter(MethodBuilder builder, ParameterModel context) { var paramBuilder = builder.DefineParameter(context.Position, context.ParameterAttributes, context.ParameterName); if (context.HasDefaultValue) { paramBuilder.SetConstant(context.DefaultValue); } foreach (var attr in context.Attributes) { var customAttributeBuilder = CustomAttributeBuilderFactory.Build(attr); if (customAttributeBuilder != null) { paramBuilder.SetCustomAttribute(customAttributeBuilder); } } return(builder); }