Example #1
0
        /// <summary>
        /// Return the approximate distinct count using the APPROX_COUNT_DISTINCT function.
        /// </summary>
        /// <param name="tableDbCommand">The table database command.</param>
        /// <param name="columnName">Name of the column.</param>
        public static ILink <long> AsCountDistinctApproximate(this TableDbCommandBuilder <SqlCommand, SqlParameter, SqlServerLimitOption> tableDbCommand, string columnName)
        {
            if (tableDbCommand == null)
            {
                throw new ArgumentNullException(nameof(tableDbCommand), $"{nameof(tableDbCommand)} is null.");
            }

            return(((ISupportsApproximateCount)tableDbCommand).AsCountApproximate(columnName));
        }
Example #2
0
 /// <summary>
 /// Allows compilation of the ToObject and ToCollection materializer.
 /// </summary>
 /// <typeparam name="TCommand">The type of the command.</typeparam>
 /// <typeparam name="TParameter">The type of the parameter.</typeparam>
 /// <typeparam name="TLimit">The type of the limit option.</typeparam>
 /// <typeparam name="TObject">The type of the object to be constructed.</typeparam>
 /// <param name="commandBuilder">The command builder.</param>
 public static CompiledMultipleRow <TCommand, TParameter, TObject> Compile <TCommand, TParameter, TLimit, TObject>(this TableDbCommandBuilder <TCommand, TParameter, TLimit, TObject> commandBuilder)
     where TCommand : DbCommand
     where TParameter : DbParameter
     where TLimit : struct         //really an enum
     where TObject : class, new()
 {
     return(new CompiledMultipleRow <TCommand, TParameter, TObject>(commandBuilder));
 }