public static IWrappedCommand CreateProcedure <T>(this ICommandCreator creator, string name, IList <string> paramNames, T value, QueryOptions queryOptions = null, FromTypeOption fromTypeOption = FromTypeOption.Both)
 {
     return(creator.Set(x =>
     {
         var o = x.PrepareQueryOptions(queryOptions);
         return x.CommandCompilator.CompileProcedure <T>(name, paramNames, fromTypeOption, o.CaseSensitiveParamsMatching.Value).Create(x, value, o);
     }));
 }
 public static IWrappedCommand CreateProcedure <T>(this ICommandCreator creator, string name, IList <FieldSettings <T> > settings, T value, QueryOptions queryOptions = null)
 {
     return(creator.Set(x =>
     {
         var o = x.PrepareQueryOptions(queryOptions);
         return x.CommandCompilator.CompileProcedure(name, settings, o.CaseSensitiveParamsMatching.Value).Create(x, value, o);
     }));
 }
 public static IWrappedCommand CreateMapped <T>(this ICommandCreator creator, string commandText, T value, QueryOptions queryOptions = null, FromTypeOption fromTypeOption = FromTypeOption.Default)
 {
     return(creator.Set(x =>
     {
         var o = x.PrepareQueryOptions(queryOptions);
         return x.CommandCompilator.CompileMapped <T>(commandText, fromTypeOption, o.CaseSensitiveParamsMatching.Value).Create(x, value, o);
     }));
 }
 public static IWrappedCommand CreateMapped <T>(this ICommandCreator creator, string commandText, IList <string> paramNames, IList <FieldSettings <T> > settings, T value, QueryOptions queryOptions = null)
 {
     return(creator.Set(x =>
     {
         var o = x.PrepareQueryOptions(queryOptions);
         return x.CommandCompilator.CompileMapped(commandText, paramNames, settings, o.CaseSensitiveParamsMatching.Value).Create(x, value, o);
     }));
 }
 // making your own custom command accessible from all types of contexts (connection string, connection, transaction)
 public static IWrappedCommand CreateSelectTop10Employees(this ICommandCreator creator)
 {
     return(creator.Set(c =>
     {
         var cmd = c.CreateCommand("select top 10 * from dbo.Employee");
         cmd.CommandType = System.Data.CommandType.Text;
         cmd.CommandTimeout = 1000;
         return cmd;
     }));
 }
 public static IWrappedCommand CreateMapped <T>(this ICommandCreator creator, MappedCommand <T> precompiledCommand, T value, QueryOptions queryOptions = null)
 {
     return(creator.Set(x => precompiledCommand.Create(x, value, queryOptions)));
 }
 public static IWrappedCommand CreateProcedureSimple(this ICommandCreator creator, QueryOptions queryOptions, string name, params DbParameter[] parameters)
 {
     return(creator.Set(x => x.CommandCompilator.CompileProcedureSimple(name).Create(x, queryOptions, parameters)));
 }
 public static IWrappedCommand CreateSimple(this ICommandCreator creator, QueryOptions queryOptions, SimpleCommand precompiledCommand, params object[] parameters)
 {
     return(creator.Set(x => precompiledCommand.Create(x, queryOptions, parameters)));
 }
 public static IWrappedCommand CreateMerge <T>(this ICommandCreator creator, string tableName, T value, QueryOptions queryOptions, params string[] keyFields)
 {
     return(creator.Set(x => x.CommandCompilator.CompileMerge <T>(tableName, keyFields).Create(x, value, queryOptions)));
 }
Esempio n. 10
0
 public static IWrappedCommand CreateInsertWithOutput <T>(this ICommandCreator creator, string tableName, T value, QueryOptions queryOptions, IList <string> ignoreFields, params string[] outputFields)
 {
     return(creator.Set(x => x.CommandCompilator.CompileInsertWithOutput <T>(tableName, FieldSettings.FromType <T>(FromTypeOption.Default), ignoreFields, outputFields).Create(x, value, queryOptions)));
 }
Esempio n. 11
0
 public static IWrappedCommand CreateSimple(this ICommandCreator creator, QueryOptions queryOptions, string commandText, params object[] parameters)
 {
     return(creator.Set(x => x.CommandCompilator.CompileSimple(commandText).Create(x, queryOptions, parameters)));
 }