private void AddRows <TEntity>(HorizontalReportSchemaBuilder <TEntity> builder, ReportVariableData[] reportVariables, Attribute[] globalAttributes)
 {
     foreach (ReportVariableData x in reportVariables)
     {
         this.AddRow(builder, x.Property, x.Attribute, globalAttributes);
     }
 }
        private void AddRow <TEntity>(HorizontalReportSchemaBuilder <TEntity> builder, PropertyInfo property, ReportVariableAttribute attribute, Attribute[] globalAttributes)
        {
            IReportCellsProvider <TEntity> instance = this.CreateCellsProvider <TEntity>(property, attribute);

            builder.AddRow(instance);
            builder.AddAlias(property.Name);

            this.ApplyAttributes(builder, property, globalAttributes);
        }
        private HorizontalReportSchemaBuilder <TEntity> BuildHorizontalReportNoPostBuild <TEntity>()
        {
            HorizontalReportSchemaBuilder <TEntity> builder = new HorizontalReportSchemaBuilder <TEntity>();

            ReportVariableData[] reportVariables  = this.GetProperties <TEntity>();
            Attribute[]          globalAttributes = this.GetGlobalAttributes <TEntity>();

            this.AddRows(builder, reportVariables, globalAttributes);
            this.AddComplexHeader(builder, reportVariables);

            return(builder);
        }
        private HorizontalReportSchemaBuilder <TEntity> BuildHorizontalReport <TEntity>(HorizontalReportAttribute reportAttribute)
        {
            HorizontalReportSchemaBuilder <TEntity> builder = this.BuildHorizontalReportNoPostBuild <TEntity>();

            if (reportAttribute?.PostBuilder != null &&
                typeof(IHorizontalReportPostBuilder <TEntity>).IsAssignableFrom(reportAttribute.PostBuilder))
            {
                ((IHorizontalReportPostBuilder <TEntity>)ActivatorUtilities.GetServiceOrCreateInstance(this.serviceProvider, reportAttribute.PostBuilder))
                .Build(builder);
            }

            return(builder);
        }
        private HorizontalReportSchemaBuilder <TEntity> BuildHorizontalReport <TEntity, TBuildParameter>(
            HorizontalReportAttribute reportAttribute, TBuildParameter parameter)
        {
            HorizontalReportSchemaBuilder <TEntity> builder = this.BuildHorizontalReportNoPostBuild <TEntity>();

            if (reportAttribute?.PostBuilder == null)
            {
                throw new InvalidOperationException($"Type {typeof(TEntity)} does not have post-builder.");
            }

            if (!typeof(IHorizontalReportPostBuilder <TEntity, TBuildParameter>).IsAssignableFrom(reportAttribute.PostBuilder))
            {
                throw new InvalidOperationException($"Type {reportAttribute.PostBuilder} is not assignable to {typeof(IHorizontalReportPostBuilder<TEntity, TBuildParameter>)}.");
            }

            ((IHorizontalReportPostBuilder <TEntity, TBuildParameter>)ActivatorUtilities.GetServiceOrCreateInstance(this.serviceProvider, reportAttribute.PostBuilder))
            .Build(builder, parameter);

            return(builder);
        }