Exemplo n.º 1
0
        public static int Execute(this EphemeralDatabaseContext context, string commandText, Dictionary <string, object> parameters = null, CommandType commandType = CommandType.Text)
        {
            var cmd = new SqlCommand {
                Connection = context.Connection
            };

            PrepareCommand(commandText, parameters, commandType, cmd);
            return(cmd.ExecuteNonQuery());
        }
Exemplo n.º 2
0
        public static IEnumerable <TRecord> ExecuteQuery <TRecord>(this EphemeralDatabaseContext context, string commandText, Dictionary <string, object> parameters = null, CommandType commandType = CommandType.Text)
            where TRecord : class, new()
        {
            var cmd = new SqlCommand {
                Connection = context.Connection
            };

            PrepareCommand(commandText, parameters, commandType, cmd);
            return(ExecuteQuery <TRecord>(cmd));
        }