示例#1
0
        public static DataTable Pivot(this IDataReader reader, PivotDef pivotDef, Comparison <PivotedColumn> pivotedColumnComparison)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (pivotDef == null)
            {
                throw new ArgumentNullException("pivotDef");
            }
            if (pivotedColumnComparison == null)
            {
                throw new ArgumentNullException("pivotedColumnComparison");
            }
            if (pivotDef.UnpivotedColumnNames == null)
            {
                throw new ArgumentException("UnpivotedColumns must not be null");
            }
            if (pivotDef.PivotTransforms == null)
            {
                throw new ArgumentException("PivotColumns must not be null");
            }
            if (pivotDef.PivotTransforms.Any(x => x == null))
            {
                throw new ArgumentException("All PivotColums mut be not null");
            }
            var builder = new SimplePivotBuilder(pivotDef, reader, pivotedColumnComparison);

            return(builder.Build());
        }
示例#2
0
 public SimplePivotBuilder(PivotDef pivotDef, IDataReader reader, Comparison <PivotedColumn> pivotedColumnComparison)
 {
     this.PivotedColumnComparison = pivotedColumnComparison;
     this.PivotDef = pivotDef;
     this.Reader   = reader;
 }
示例#3
0
 public static DataTable Pivot(this IDataReader reader, PivotDef pivotDef)
 {
     return(Pivot(reader, pivotDef, DefaultPivotedColumnComparison));
 }