/// <summary> /// Enumerates items for a set of data objects of the specified type /// with the specified restrictions and sort string, if supported. /// </summary> /// <param name="typeName">Name of the type of the object to enumerate.</param> /// <param name="items"> /// The set of items to enumerate, specified as strings where named items are available, /// otherwise as indexes. In cases in which a data provider does not support items /// filtering, this parameter is ignored. /// NOT SUPPORTED. /// </param> /// <param name="restrictions"> /// A set of filtering restrictions to apply to the set of returned objects. /// </param> /// <param name="sort"> /// A sort string, which follows syntax for the SQL Server ORDER BY clause. /// The actual sort order should be source-based; that is, if the client is /// English and the source is Chinese, the sort should be applied in Chinese. /// NOT SUPPORTED. /// </param> /// <param name="parameters"> /// An array whose contents are defined by the given implementation of /// EnumerateObjects, and which is specified by the Data Object Support /// XML file. Information supplied in this parameter can be used to provide /// extra data indicating how to perform the enumeration, allowing /// implementations of this method to be more data driven. /// NOT USED. /// </param> /// <returns> /// Returns a DataReader object containing the results of the enumeration call. /// </returns> public override DataReader EnumerateObjects( string typeName, object[] items, object[] restrictions, string sort, object[] parameters) { if (typeName == null) { throw new ArgumentNullException("typeName"); } // Chose restricitions array object[] appliedRestrictions; if (typeName.Equals(RootDescriptor.TypeName, StringComparison.InvariantCultureIgnoreCase)) { appliedRestrictions = new object[] { ConnectionWrapper.ServerName, ConnectionWrapper.Schema }; } else { appliedRestrictions = restrictions; } DataTable table; try { // Enumerate objects into table table = ObjectDescriptor.EnumerateObjects(ConnectionWrapper, typeName, appliedRestrictions, sort); } catch (DbException e) { SqlErrorDialog.ShowError(e, ConnectionWrapper.GetFullStatus()); throw; } catch (Exception e) { UIHelper.ShowError(e); throw; } // Validate table if (table == null) { Debug.Fail("Failed to enumerate objects of type '" + typeName + "'!"); return(null); } // Enumerete objects in to DataReader return(new AdoDotNetDataTableReader(table)); }