protected internal ADGenericPagedReader(IDirectorySession session, ADObjectId rootId, QueryScope scope, QueryFilter filter, SortBy sortBy, int pageSize, IEnumerable <PropertyDefinition> properties, bool skipCheckVirtualIndex) : base(session, rootId, scope, sortBy) { if (!typeof(ADRawEntry).IsAssignableFrom(typeof(TResult))) { throw new InvalidOperationException(DirectoryStrings.ErrorMustBeADRawEntry); } if (pageSize < 0 || pageSize > 10000) { throw new ArgumentOutOfRangeException("pageSize", pageSize, string.Format("pageSize should be between 1 and {0} or 0 to use the default page size: {1}", 10000, ADGenericPagedReader <TResult> .DefaultPageSize)); } this.dummyInstance = (ADRawEntry)((object)((default(TResult) == null) ? Activator.CreateInstance <TResult>() : default(TResult))); QueryFilter filter2 = filter; ConfigScopes configScopes; ADScope readScope = session.GetReadScope(rootId, this.dummyInstance, false, out configScopes); ADObject adobject; string[] ldapAttributes; base.Session.GetSchemaAndApplyFilter(this.dummyInstance, readScope, out adobject, out ldapAttributes, ref filter, ref properties); ADDataSession addataSession = base.Session as ADDataSession; if (addataSession != null) { addataSession.UpdateFilterforInactiveMailboxSearch(this.dummyInstance, ref filter); } base.LdapAttributes = ldapAttributes; this.pageSize = ((pageSize == 0) ? ADGenericPagedReader <TResult> .DefaultPageSize : pageSize); this.retrievedAllData = null; this.properties = properties; session.CheckFilterForUnsafeIdentity(filter2); base.LdapFilter = LdapFilterBuilder.LdapFilterFromQueryFilter(filter, skipCheckVirtualIndex, base.Session.SessionSettings.PartitionSoftLinkMode, base.Session.SessionSettings.IsTenantScoped); this.skipNonUniqueResults = (session is IConfigurationSession); }
internal ADVirtualListView(IDirectorySession session, ADObjectId rootId, ADObjectId[] addressListIds, SortBy sortBy, int rowsToPrefetch, IEnumerable <PropertyDefinition> properties) : base(session, rootId, QueryScope.SubTree, sortBy) { if (properties == null) { throw new ArgumentNullException("properties"); } if (sortBy == null) { throw new ArgumentNullException("sortBy"); } if (rowsToPrefetch < 1) { throw new ArgumentOutOfRangeException("rowsToPrefetch"); } this.rowsToPrefetch = rowsToPrefetch; QueryFilter[] array; if (addressListIds == null) { array = new QueryFilter[2]; array[0] = new ExistsFilter(ADRecipientSchema.AddressListMembership); } else { array = new QueryFilter[addressListIds.Length + 1]; for (int i = 0; i < addressListIds.Length; i++) { array[i] = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.AddressListMembership, addressListIds[i]); } } array[array.Length - 1] = new ExistsFilter(ADRecipientSchema.DisplayName); QueryFilter queryFilter = new AndFilter(array); QueryFilter queryFilter2 = (addressListIds == null) ? queryFilter : new ExistsFilter(ADObjectSchema.ObjectClass); this.requestedProperties = properties; ADScope readScope = session.GetReadScope(rootId, ADVirtualListView.dummyADRawEntry); ADObject adobject; string[] ldapAttributes; session.GetSchemaAndApplyFilter(ADVirtualListView.dummyADRawEntry, readScope, out adobject, out ldapAttributes, ref queryFilter2, ref properties); base.LdapAttributes = ldapAttributes; this.properties = properties; base.LdapFilter = LdapFilterBuilder.LdapFilterFromQueryFilter((addressListIds == null) ? queryFilter2 : queryFilter, false, base.Session.SessionSettings.PartitionSoftLinkMode, base.Session.SessionSettings.IsTenantScoped); this.vlvRequestControl = new VlvRequestControl(); this.vlvRequestControl.AfterCount = this.rowsToPrefetch; base.DirectoryControls.Add(this.vlvRequestControl); }