protected static void CheckNotMember(DataIdentityList dataIdentities, IDataIdentity dataIdentity, String listName) { if (IsNotNull(dataIdentities.GetById(dataIdentity.GetId()))) { throw new DataArgumentException(dataIdentity.GetDataType().ToString() + " " + dataIdentity.GetIdentifier() + " is already a member of " + listName); } }
protected static Int32 GetId(IDataIdentity dataIdentity) { if (IsNull(dataIdentity)) { return(NO_ID); } else { return(dataIdentity.GetId()); } }
public Int32 GetIndex(IDataIdentity dataIdentity) { Int32 index; for (index = 0; index < this.Count; index++) { if ((((IDataIdentity)(this[index])).GetDataType() == dataIdentity.GetDataType()) && (((IDataIdentity)(this[index])).GetId() == dataIdentity.GetId())) { return(index); } } return(-1); }
public static Boolean AreEqual(IDataIdentity object1, IDataIdentity object2) { // Check referenses. if (IsNull(object1) && IsNull(object2)) { return(true); } if (IsNull(object1) || IsNull(object2)) { return(false); } // Check type. if (object1.GetDataType() != object2.GetDataType()) { return(false); } // Check id. return(object1.GetId() == object2.GetId()); }