Пример #1
0
        public static IDbDataParameter CreateDataParameter(IDataParameterCollection dataParameterCollection)
        {
            var    nameSpace = dataParameterCollection.GetType().Namespace;
            string strType   = ClientType.Unknow.ToString();

            _dicNameSpacesToDbType.TryGetValue(nameSpace, out strType);
            return(GetInstance <IDbDataParameter>(strType, regParameter));
        }
Пример #2
0
        } // end method



        private static IDbDataParameter AttemptAddWithValue(IDataParameterCollection parameters,
            string name, object value) {
            var mirror = Mirror.mirrorCache[parameters.GetType()];
            var addWithValue = mirror.GetMethod("AddWithValue", new[] {typeof(string), typeof(object)});
            if (addWithValue == null)
                return null;

            var parameter = addWithValue.Invoke(parameters, new[] {name, value});
            return parameter as IDbDataParameter;
        } // end method
Пример #3
0
 /// <summary>
 /// Copies records from a parameter collection.
 /// </summary>
 /// <param name="Source">The parameter collection</param>
 private void CopyFrom(IDataParameterCollection Source)
 {
     IDataParameter[] A = new IDataParameter[Source.Count];
     Source.GetType().InvokeMember("CopyTo",
                                   BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance,
                                   null, Source, new object[] { A, 0 });
     for (int i = 0; i < A.Length; i++)
     {
         Add(new ParameterDef(Source[i]));
     }
 }
 internal static Exception InvalidParameterType(IDataParameterCollection collection, Type parameterType, object invalidValue)
 {
     return(CollectionInvalidType(collection.GetType(), parameterType, invalidValue));
 }
 internal static Exception ParameterNull(string parameter, IDataParameterCollection collection, Type parameterType)
 {
     return(CollectionNullValue(parameter, collection.GetType(), parameterType));
 }
 internal static Exception ParametersSourceIndex(string parameterName, IDataParameterCollection collection, Type parameterType)
 {
     return(CollectionIndexString(parameterType, ADP.ParameterName, parameterName, collection.GetType()));
 }
 //
 // : IDataParameterCollection
 //
 internal static Exception ParametersMappingIndex(int index, IDataParameterCollection collection)
 {
     return(CollectionIndexInt32(index, collection.GetType(), collection.Count));
 }
Пример #8
0
 internal static ArgumentException ParametersIsParent(Type parameterType, IDataParameterCollection collection)
 {
     return(Argument(System.Data.OracleClient.Res.GetString("ADP_CollectionIsNotParent", new object[] { parameterType.Name, collection.GetType().Name })));
 }
 internal static Exception ParametersSourceIndex(string parameterName, IDataParameterCollection collection, Type parameterType)
 {
     return CollectionIndexString(parameterType, "ParameterName", parameterName, collection.GetType());
 }
 internal static Exception ParametersMappingIndex(int index, IDataParameterCollection collection)
 {
     return CollectionIndexInt32(index, collection.GetType(), collection.Count);
 }
 internal static Exception ParameterNull(string parameter, IDataParameterCollection collection, Type parameterType)
 {
     return CollectionNullValue(parameter, collection.GetType(), parameterType);
 }
 internal static Exception InvalidParameterType(IDataParameterCollection collection, Type parameterType, object invalidValue)
 {
     return CollectionInvalidType(collection.GetType(), parameterType, invalidValue);
 }
 internal static ArgumentException ParametersIsParent(Type parameterType, IDataParameterCollection collection)
 {
     return Argument(System.Data.OracleClient.Res.GetString("ADP_CollectionIsNotParent", new object[] { parameterType.Name, collection.GetType().Name }));
 }
Пример #14
0
 static internal Exception ParametersIsParent(Type parameterType, string parameterName, IDataParameterCollection collection)
 {
     return(Argument(Res.GetString(Res.ADP_CollectionIsNotParent, parameterType.Name, "ParameterName", parameterName, collection.GetType().Name)));
 }