/// <summary> /// Checks if a determinate instance exists /// </summary> /// <param name="oid">OID to search the instance</param> /// <param name="onFilterList">Filters to theck</param> /// <returns>If exists</returns> public override bool Exist(ONOid oid, ONFilterList onFilterList) { if ((onFilterList == null) || (!onFilterList.InMemory)) { ONSqlCount lOnSql = new ONSqlCount(); // Create select and first table string lAlias = lOnSql.CreateAlias(TableName, null, ClassName); lOnSql.AddSelect(lAlias); // Fix instance InhFixInstance(lOnSql, null, null, oid); // Add filter formula if (onFilterList != null) { onFilterList.FilterInData(lOnSql, this); } // Execute return(Convert.ToInt32(Execute(lOnSql)) > 0); } else { return(Search(oid, onFilterList, null) != null); } }
/// <summary> /// Checks if the instance exists in local system. /// </summary> /// <param name="oid">OID to search the instance</param> public bool LocalExist(ONOid oid) { ONSqlSelect onSql = new ONSqlCount(); // Create select and first table string lAlias = onSql.CreateAlias(ClassName, null, ClassName); onSql.AddSelect(lAlias); // Fix instance InhFixInstance(onSql, null, null, oid); // Execute return(Convert.ToInt32(Execute(onSql)) > 0); }