protected static DbParameter CreateOutputParameter(string name, SqlDbType paramType) { var parameter = SqlDbFactory.CreateParameter(paramType); parameter.ParameterName = name; parameter.Direction = ParameterDirection.Output; return(parameter); }
protected static DbCommand GetDbSprocCommand(string storedProcedureName) { var command = SqlDbFactory.CreateCommand(storedProcedureName); command.Connection = GetDbConnection(); command.CommandType = CommandType.StoredProcedure; return(command); }
protected static DbParameter CreateNullParameter(string name, SqlDbType paramType, int size) { var parameter = SqlDbFactory.CreateParameter(paramType); parameter.ParameterName = name; parameter.Size = size; parameter.Value = null; parameter.Direction = ParameterDirection.Input; return(parameter); }
protected static DbParameter CreateParameter(string name, Guid?value) { if (!value.HasValue) { return(CreateNullParameter(name, SqlDbType.UniqueIdentifier)); } else { var parameter = SqlDbFactory.CreateParameter(SqlDbType.UniqueIdentifier); parameter.ParameterName = name; parameter.Value = value.Value; parameter.Direction = ParameterDirection.Input; return(parameter); } }
protected static DbParameter CreateParameter(string name, string value) { if (string.IsNullOrEmpty(value)) { return(CreateNullParameter(name, SqlDbType.NVarChar)); } else { var parameter = SqlDbFactory.CreateParameter(SqlDbType.NVarChar); parameter.ParameterName = name; parameter.Value = value; parameter.Direction = ParameterDirection.Input; return(parameter); } }
public static DbConnection GetDbConnection() { return(SqlDbFactory.CreateConnection(ConnectionString)); }