IndexOf() public method

Returns the index of the specified .
public IndexOf ( Constraint constraint ) : int
constraint Constraint
return int
Exemplo n.º 1
0
        internal static void SetAsPrimaryKey(ConstraintCollection collection, UniqueConstraint newPrimaryKey)
        {
            //not null
            if (null == collection)
            {
                throw new ArgumentNullException("ConstraintCollection can't be null.");
            }

            //make sure newPrimaryKey belongs to the collection parm unless it is null
            if (collection.IndexOf(newPrimaryKey) < 0 && (null != newPrimaryKey))
            {
                throw new ArgumentException("newPrimaryKey must belong to collection.");
            }

            //Get existing pk
            UniqueConstraint uc = GetPrimaryKeyConstraint(collection);

            //clear existing
            if (null != uc)
            {
                uc._isPrimaryKey = false;
            }

            //set new key
            if (null != newPrimaryKey)
            {
                newPrimaryKey._isPrimaryKey = true;
            }
        }
Exemplo n.º 2
0
		internal static void SetAsPrimaryKey(ConstraintCollection collection, UniqueConstraint newPrimaryKey)
		{
			//not null
			if (null == collection) throw new ArgumentNullException("ConstraintCollection can't be null.");
			
			//make sure newPrimaryKey belongs to the collection parm unless it is null
			if (  collection.IndexOf(newPrimaryKey) < 0 && (null != newPrimaryKey) ) 
				throw new ArgumentException("newPrimaryKey must belong to collection.");
			
			//Get existing pk
			UniqueConstraint uc = GetPrimaryKeyConstraint(collection);
			
			//clear existing
			if (null != uc) uc._isPrimaryKey = false;

			//set new key
			if (null != newPrimaryKey) newPrimaryKey._isPrimaryKey = true;
			
			
		}