Esempio n. 1
0
        /// <summary>
        /// Creates a new DBParam with a delegate method as the value provider (no parameters, returns object).
        /// NOTE: The parameter type cannot be determined if null or DBUnll is passed as the value
        /// </summary>
        /// <param name="valueprovider">The delegate method (cannot be null)</param>
        /// <returns></returns>
        /// <remarks>
        ///  The method will be executed when any queries using this parameter are converted to their SQL statements
        /// </remarks>
        public static DBParam ParamWithDelegate(ParamValue valueprovider)
        {
            if (null == valueprovider)
            {
                throw new ArgumentNullException("valueProvider");
            }

            DBDelegateParam del = new DBDelegateParam(valueprovider);

            return(del);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new DBParam with the specified name and a delegate method as the value provider (no parameters, returns object).
        /// NOTE: The parameter type cannot be determined if null or DBUnll is passed as the value
        /// </summary>
        /// <param name="genericName">The name of the parameter</param>
        /// <param name="valueprovider">The delegate method (cannot be null)</param>
        /// <returns></returns>
        /// <remarks>
        ///  The method will be executed when any queries using this parameter are converted to their SQL statements
        /// </remarks>
        public static DBParam ParamWithDelegate(string genericName, ParamValue valueprovider)
        {
            if (null == valueprovider)
            {
                throw new ArgumentNullException("valueProvider");
            }

            DBDelegateParam del = new DBDelegateParam(valueprovider);

            del.Name = genericName;
            return(del);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates a new DBParam with a delegate method as the value provider (no parameters, returns object).
        /// </summary>
        /// <param name="type">The DbType of the parameter </param>
        /// <param name="valueProvider">The delegate method (cannot be null)</param>
        /// <returns></returns>
        /// <remarks>
        ///  The valueProvider method will be executed when any queries using this parameter are converted to their SQL statements
        /// </remarks>
        public static DBParam ParamWithDelegate(System.Data.DbType type, ParamValue valueProvider)
        {
            if (null == valueProvider)
            {
                throw new ArgumentNullException("valueProvider");
            }

            DBDelegateParam del = new DBDelegateParam(valueProvider);

            del.DbType = type;
            return(del);
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new DBParam with the specified name, type, size and a delegate method as the value provider (no parameters, returns object).
        /// </summary>
        /// <param name="genericName">The generic name of the parameter (e.g. param1 rather than @param1)</param>
        /// <param name="type">The DbType of the parameter</param>
        /// <param name="size">The maximum size of the parameter value</param>
        /// <param name="valueprovider">The delegate method (cannot be null)</param>
        /// <returns></returns>
        /// <remarks>
        ///  The method will be executed when any queries using this parameter are converted to their SQL statements
        /// </remarks>
        public static DBParam ParamWithDelegate(string genericName, System.Data.DbType type, int size, ParamValue valueprovider)
        {
            if (null == valueprovider)
            {
                throw new ArgumentNullException("valueProvider");
            }

            DBDelegateParam del = new DBDelegateParam(valueprovider);

            del.DbType = type;
            del.Size   = size;
            del.Name   = genericName;
            return(del);
        }