/// <summary> /// Creates an input parameter with the specified name, type and value. /// </summary> /// <param name="name">The name of the parameter.</param> /// <param name="type">The type of the parameter.</param> /// <param name="value">The value of the parameter.</param> /// <returns>An input parameter with the specified name, type and value</returns> public IDbDataParameter CreateParameter(string name, ADONETType type, object value) { var param = CreateParameter(name, type); param.Value = value ?? DBNull.Value; return(param); }
/// <summary> /// Creates an input parameter with the specified name, type, size and value. /// </summary> /// <param name="name">The name of the parameter.</param> /// <param name="type">The type of the parameter.</param> /// <param name="size">The size of the parameter.</param> /// <param name="value">The value of the parameter.</param> /// <returns></returns> public IDbDataParameter CreateParameter(string name, ADONETType type, int size, object value) { var param = CreateParameter(name, type, value); param.Size = size; return(param); }
/// <summary> /// Creates an output parameter with the specified name, type and size. /// </summary> /// <param name="name">The name of the parameter.</param> /// <param name="type">The type of the parameter.</param> /// <param name="size">The size of the parameter.</param> /// <returns>An output parameter with the specified name, type and size.</returns> public IDbDataParameter CreateOutputParameter(string name, ADONETType type, int size) { var param = CreateOutputParameter(name, type); param.Size = size; return(param); }
/// <summary> /// Creates an output parameter with the specified name and type. /// </summary> /// <param name="name">The name of the parameter.</param> /// <param name="type">The type of the parameter.</param> /// <returns>An output parameter with the specified name and type.</returns> public IDbDataParameter CreateOutputParameter(string name, ADONETType type) { var param = CreateParameter(name, type); param.Direction = ParameterDirection.Output; return(param); }
/// <summary> /// Creates an instance of TParameter with the specified name and type. /// </summary> /// <param name="name">The name of the parameter.</param> /// <param name="type">The type of the parameter.</param> /// <returns>An instance of TParameter with the specified name and type.</returns> protected virtual IDbDataParameter CreateParameter(string name, ADONETType type) { return(new TParameter() { ParameterName = name, DbType = type.ToDbType() }); }
public DbTypeMap(ADONETType adonetType, DbType?dbType, SqlDbType?sqlDbType, OleDbType?oleDbType, OdbcType?odbcType) : this() { ADONETType = adonetType; DbType = dbType; SqlDbType = sqlDbType; OleDbType = oleDbType; OdbcType = odbcType; }
private static dynamic ConvertTo <T>(this ADONETType type) { var returnValue = _Map.First(m => m.ADONETType == type).GetValueByType(typeof(T)); if (returnValue != null) { return(returnValue); } throw new NotSupportedException(string.Format("ADONETType {0} is not supported for {1}", type, typeof(T))); }
internal static OdbcType ToOdbcType(this ADONETType type) { return(type.ConvertTo <OdbcType>()); }
internal static SqlDbType ToSqlType(this ADONETType type) { return(type.ConvertTo <SqlDbType>()); }
internal static DbType ToDbType(this ADONETType type) { return(type.ConvertTo <DbType>()); }
/// <summary> /// Creates a new instance of the OleDbParameter class. /// </summary> /// <param name="name">The name of the paramenter.</param> /// <param name="type">The type of the parameter.</param> /// <returns>A new instance of OleDbParameter with the specified name and type.</returns> protected override IDbDataParameter CreateParameter(string name, ADONETType type) { return(new OleDbParameter(name, type.ToOleDbType())); }
/// <summary> /// Creates a new instance of the OdbcParameter class. /// </summary> /// <param name="name">The name of the paramenter.</param> /// <param name="type">The type of the parameter.</param> /// <returns>A new instance of OdbcParameter with the specified name and type.</returns> protected override System.Data.IDbDataParameter CreateParameter(string name, ADONETType type) { return(new OdbcParameter(name, type.ToOdbcType())); }