public int Add(CrmParameter value)
 {
     if (value.CanAddToCommand())
     {
         var nextIndex = _Params.Count;
         _Params.Add(value);
         return nextIndex;
     }
     throw new ArgumentException("parameter must be named");
 }
Example #2
0
 public int Add(CrmParameter value)
 {
     if (value.CanAddToCommand())
     {
         var nextIndex = _Params.Count;
         _Params.Add(value);
         return(nextIndex);
     }
     throw new ArgumentException("parameter must be named");
 }
        /// <summary>
        /// Creates a SqlParameter given a name, type, and direction
        /// </summary>
        internal static CrmParameter CreateParameter(string name, TypeUsage type, ParameterMode mode, object value)
        {
            // int? size;

            value = EnsureParameterValue(value);

            CrmParameter result = new CrmParameter(name, value);

            throw new NotImplementedException();

            //// .Direction
            //result.Direction = MetadataHelpers.ParameterModeToParameterDirection(mode);

            //// .Size and .SqlDbType
            //// output parameters are handled differently (we need to ensure there is space for return
            //// values where the user has not given a specific Size/MaxLength)
            //bool isOutParam = mode != ParameterMode.In;

            //string udtTypeName;
            //result.DbType = GetSqlDbType(type, isOutParam, out size, out udtTypeName);
            //result.UdtTypeName = udtTypeName;

            //// Note that we overwrite 'facet' parameters where either the value is different or
            //// there is an output parameter.
            //if (size.HasValue && (isOutParam || result.Size != size.Value))
            //{
            //    result.Size = size.Value;
            //}

            //// .IsNullable
            //bool isNullable = MetadataHelpers.IsNullable(type);
            //if (isOutParam || isNullable != result.IsNullable)
            //{
            //    result.IsNullable = isNullable;
            //}

            //return result;
        }