private void AddComplexHeader <TEntity>(ReportSchemaBuilder <TEntity> builder, ReportVariableData[] properties) { Dictionary <int, Dictionary <string, List <int> > > complexHeader = new Dictionary <int, Dictionary <string, List <int> > >(); foreach (ReportVariableAttribute property in properties.Select(p => p.Attribute)) { for (int i = 0; i < property.ComplexHeader.Length; i++) { if (!complexHeader.ContainsKey(i)) { complexHeader.Add(i, new Dictionary <string, List <int> >()); } string title = property.ComplexHeader[i]; if (!complexHeader[i].ContainsKey(title)) { complexHeader[i].Add(title, new List <int>()); } complexHeader[i][title].Add(property.Order); } } int minimumIndex = properties.Min(p => p.Attribute.Order); foreach ((int index, Dictionary <string, List <int> > header) in complexHeader) { foreach ((string title, List <int> columns) in header) { builder.AddComplexHeader(index, title, columns.Min() - minimumIndex, columns.Max() - minimumIndex); } } }
private void ApplyAttributes <TEntity>(ReportSchemaBuilder <TEntity> builder, PropertyInfo property, Attribute[] globalAttributes) { Attribute[] propertyAttributes = property.GetCustomAttributes().ToArray(); Attribute[] attributes = this.MergeGlobalAttributes(propertyAttributes, globalAttributes); foreach (Attribute attribute in attributes) { foreach (IAttributeHandler handler in this.attributeHandlers) { handler.Handle(builder, attribute); } } }