Esempio n. 1
0
        internal static UniqueConstraint GetPrimaryKeyConstraint(ConstraintCollection collection)
        {
            if (null == collection)
            {
                throw new ArgumentNullException("Collection can't be null.");
            }

            UniqueConstraint uc;
            IEnumerator      enumer = collection.GetEnumerator();

            while (enumer.MoveNext())
            {
                uc = enumer.Current as UniqueConstraint;
                if (null == uc)
                {
                    continue;
                }

                if (uc.IsPrimaryKey)
                {
                    return(uc);
                }
            }

            //if we got here there was no pk
            return(null);
        }
Esempio n. 2
0
		internal static UniqueConstraint GetPrimaryKeyConstraint(ConstraintCollection collection)
		{
			if (null == collection) throw new ArgumentNullException("Collection can't be null.");

			UniqueConstraint uc;
			IEnumerator enumer = collection.GetEnumerator();
			while (enumer.MoveNext())
			{
				uc = enumer.Current as UniqueConstraint;
				if (null == uc) continue;
				
				if (uc.IsPrimaryKey) return uc;	
			}

			//if we got here there was no pk
			return null;
			
		}