Esempio n. 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());
        }
Esempio n. 2
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();
 }