Beispiel #1
0
 /// <summary>
 /// Adds a parameter to the call (for all types other than strings)
 /// </summary>
 /// <param name="ID">Name of the parameter</param>
 /// <param name="Value">Value to add</param>
 /// <param name="Direction">Direction that the parameter goes (in or out)</param>
 /// <param name="Command">Command object</param>
 /// <param name="Type">SQL type of the parameter</param>
 /// <returns>The DbCommand object</returns>
 public static DbCommand AddParameter(this DbCommand Command, string ID, SqlDbType Type,
                                      object Value = null, ParameterDirection Direction = ParameterDirection.Input)
 {
     Contract.Requires <ArgumentNullException>(Command != null, "Command");
     Contract.Requires <ArgumentNullException>(!string.IsNullOrEmpty(ID), "ID");
     return(Command.AddParameter(ID, Type.To(DbType.Int32), Value, Direction));
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ID">ID of the parameter</param>
 /// <param name="Type">Database type</param>
 /// <param name="Value">Value of the parameter</param>
 /// <param name="Direction">Direction of the parameter</param>
 /// <param name="ParameterStarter">What the database expects as the
 /// parameter starting string ("@" for SQL Server, ":" for Oracle, etc.)</param>
 protected ParameterBase(string ID, SqlDbType Type, object Value = null, ParameterDirection Direction = ParameterDirection.Input, string ParameterStarter = "@")
 {
     this.ID               = ID;
     this.Value            = (DataType)Value;
     this.DatabaseType     = Type.To(DbType.Int32);
     this.Direction        = Direction;
     this.BatchID          = ID;
     this.ParameterStarter = ParameterStarter;
 }
 /// <summary>
 /// Adds a parameter to the call (for all types other than strings)
 /// </summary>
 /// <param name="id">Name of the parameter</param>
 /// <param name="value">Value to add</param>
 /// <param name="direction">Direction that the parameter goes (in or out)</param>
 /// <param name="command">Command object</param>
 /// <param name="type">SQL type of the parameter</param>
 /// <returns>The DbCommand object</returns>
 public static DbCommand AddParameter(this DbCommand command, string id, SqlDbType type,
                                      object value = null, ParameterDirection direction = ParameterDirection.Input)
 {
     if (command == null)
     {
         throw new ArgumentNullException(nameof(command));
     }
     if (string.IsNullOrEmpty(id))
     {
         throw new ArgumentNullException(nameof(id));
     }
     return(command.AddParameter(id, type.To(DbType.Int32), value, direction));
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ID">ID of the parameter</param>
 /// <param name="Type">Database type</param>
 /// <param name="Value">Value of the parameter</param>
 /// <param name="Direction">Direction of the parameter</param>
 /// <param name="ParameterStarter">
 /// What the database expects as the parameter starting string ("@" for SQL Server, ":" for
 /// Oracle, etc.)
 /// </param>
 protected ParameterBase(string ID, SqlDbType Type, object Value = null, ParameterDirection Direction = ParameterDirection.Input, string ParameterStarter = "@")
     : this(ID, Type.To(DbType.Int32), Value, Direction, ParameterStarter)
 {
 }
 /// <summary>
 /// Adds a parameter to the call (for all types other than strings)
 /// </summary>
 /// <param name="ID">Name of the parameter</param>
 /// <param name="Value">Value to add</param>
 /// <param name="Type">SQL type of the parameter</param>
 /// <param name="Direction">Parameter direction (defaults to input)</param>
 /// <param name="ParameterStarter">Parameter starter</param>
 public virtual void AddParameter(string ID, SqlDbType Type, object Value = null, ParameterDirection Direction = ParameterDirection.Input, string ParameterStarter = "@")
 {
     AddParameter(ID, Type.To(DbType.Int32), Value, Direction, ParameterStarter);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="id">ID of the parameter</param>
 /// <param name="type">Database type</param>
 /// <param name="value">Value of the parameter</param>
 /// <param name="direction">Direction of the parameter</param>
 /// <param name="parameterStarter">
 /// What the database expects as the parameter starting string ("@" for SQL Server, ":" for
 /// Oracle, etc.)
 /// </param>
 protected ParameterBase(string id, SqlDbType type, object?value = null, ParameterDirection direction = ParameterDirection.Input, string parameterStarter = "@")
     : this(id, type.To(DbType.Int32), value, direction, parameterStarter)
 {
 }