예제 #1
0
        /// <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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <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);
        }
예제 #5
0
 /// <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()
     });
 }
예제 #6
0
 public DbTypeMap(ADONETType adonetType, DbType?dbType, SqlDbType?sqlDbType, OleDbType?oleDbType, OdbcType?odbcType)
     : this()
 {
     ADONETType = adonetType;
     DbType     = dbType;
     SqlDbType  = sqlDbType;
     OleDbType  = oleDbType;
     OdbcType   = odbcType;
 }
예제 #7
0
        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)));
        }
예제 #8
0
 internal static OdbcType ToOdbcType(this ADONETType type)
 {
     return(type.ConvertTo <OdbcType>());
 }
예제 #9
0
 internal static SqlDbType ToSqlType(this ADONETType type)
 {
     return(type.ConvertTo <SqlDbType>());
 }
예제 #10
0
 internal static DbType ToDbType(this ADONETType type)
 {
     return(type.ConvertTo <DbType>());
 }
예제 #11
0
 /// <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()));
 }
예제 #12
0
 /// <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()));
 }