Ejemplo n.º 1
0
 public void CreateFigureTreatmentAttribute(FieldBuilder field, FigureTreatmentAttribute attrib)
 {
     field.SetCustomAttribute(new CustomAttributeBuilder(figuresTreatmentCtor, Type.EmptyTypes,
                                                         new FieldInfo[] { typeof(FigureTreatmentAttribute).GetField("AggregateOperand"),
                                                                           typeof(FigureTreatmentAttribute).GetField("SummaryOperand") },
                                                         new object[] { attrib.AggregateOperand, attrib.SummaryOperand }));
 }
Ejemplo n.º 2
0
        private void resolveFigureTreatmentAttributes(FieldBuilder fb, MemberInfo mi, MemberRubric mr)
        {
            object[] o = mi.GetCustomAttributes(typeof(FigureTreatmentAttribute), false);
            if (o != null && o.Any())
            {
                FigureTreatmentAttribute fta = (FigureTreatmentAttribute)o.First();;
                mr.AggregateOperand = fta.AggregateOperand;
                mr.SummaryOperand   = fta.SummaryOperand;

                if (fb != null)
                {
                    CreateFigureTreatmentAttribute(fb, fta);
                }
            }
            else if (mr.AggregateOperand != AggregateOperand.None || mr.SummaryOperand != AggregateOperand.None)
            {
                CreateFigureTreatmentAttribute(fb, new FigureTreatmentAttribute()
                {
                    AggregateOperand = mr.AggregateOperand, SummaryOperand = mr.SummaryOperand
                });
            }
        }