Пример #1
0
        private VerticalReportSchemaBuilder <TEntity> BuildVerticalReport <TEntity>(VerticalReportAttribute reportAttribute)
        {
            VerticalReportSchemaBuilder <TEntity> builder = this.BuildVerticalReportNoPostBuild <TEntity>();

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

            return(builder);
        }
Пример #2
0
        private VerticalReportSchemaBuilder <TEntity> BuildVerticalReport <TEntity, TBuildParameter>(
            VerticalReportAttribute reportAttribute, TBuildParameter parameter)
        {
            VerticalReportSchemaBuilder <TEntity> builder = this.BuildVerticalReportNoPostBuild <TEntity>();

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

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

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

            return(builder);
        }