protected internal override IDataSourceNamedObject FindObject(string name) { DbSource mainSource = this.MainSource; if ((mainSource != null) && mainSource.NameExist(name)) { return(mainSource); } IEnumerator enumerator = base.InnerList.GetEnumerator(); while (enumerator.MoveNext()) { DbSource current = enumerator.Current as DbSource; if (current != null) { if (current.NameExist(name)) { return(current); } } else { IDataSourceNamedObject obj2 = (IDataSourceNamedObject)enumerator.Current; if (StringUtil.EqualValue(obj2.Name, name, false)) { return(obj2); } } } return(null); }
private void ValidateNameWithMainSource(object dbSourceToCheck, string nameToCheck) { DbSource mainSource = this.MainSource; if (((dbSourceToCheck != mainSource) && (mainSource != null)) && mainSource.NameExist(nameToCheck)) { throw new NameValidationException(System.Design.SR.GetString("CM_NameExist", new object[] { nameToCheck })); } }
private bool DbSourceNameExist(DbSource dbSource, bool isFillName, string nameToBeChecked) { if (isFillName && StringUtil.EqualValue(nameToBeChecked, dbSource.GetMethodName, true)) { return(true); } if (!isFillName && StringUtil.EqualValue(nameToBeChecked, dbSource.FillMethodName, true)) { return(true); } foreach (DbSource source in this) { if ((source != dbSource) && source.NameExist(nameToBeChecked)) { return(true); } } DbSource mainSource = this.MainSource; return(((dbSource != mainSource) && (mainSource != null)) && mainSource.NameExist(nameToBeChecked)); }