Exemple #1
0
        public static ParameterStoreCollection GetParameterStores(string[] paramNames, ParameterStoreCollection stores, out bool modified)
        {
            modified = false;
            ParameterStoreCollection l = new ParameterStoreCollection();

            foreach (string param in paramNames)
            {
                ParameterStore ps    = stores[param];
                ParameterStore psAll = AllParameters[param];
                if (ps != null)
                {
                    ps        = ps.Clone() as ParameterStore;
                    ps.Target = null;
                }
                else if (psAll != null)
                {
                    ps        = psAll.Clone() as ParameterStore;
                    ps.Target = null;
                    modified  = true;
                }
                else
                {
                    ps       = new ParameterStore(param);
                    modified = true;
                }
                l.Add(ps);

                if (psAll != null)
                {
                    ps.CopyTo(psAll);
                }
                else
                {
                    AllParameters.Add(ps.Clone() as ParameterStore);
                }
            }
            return(l);
        }
Exemple #2
0
        public static ParameterStoreCollection GetParameterStores(IDbCommand command, ParameterStoreCollection stores, out bool modified)
        {
            modified = false;
            ParameterStoreCollection l = new ParameterStoreCollection();

            foreach (DbParameter p in command.Parameters)
            {
                ParameterStore ps    = stores[p.ParameterName];
                ParameterStore psAll = AllParameters[p.ParameterName];
                if (ps != null)
                {
                    ps        = ps.Clone() as ParameterStore;
                    ps.Target = p;
                }
                else if (psAll != null)
                {
                    ps        = psAll.Clone() as ParameterStore;
                    ps.Target = p;
                    modified  = true;
                }
                else
                {
                    ps       = new ParameterStore(p);
                    modified = true;
                }
                l.Add(ps);

                if (psAll != null)
                {
                    ps.CopyTo(psAll);
                }
                else
                {
                    AllParameters.Add(ps.Clone() as ParameterStore);
                }
            }
            return(l);
        }