@@ -95,30 +95,7 @@ public async Task<IEnumerable<T>> GetAllPagedFromCollections<T>(string databaseN
95
95
96
96
return result ;
97
97
}
98
-
99
- public async Task < IEnumerable < T > > GetSpecificPagedFromCollections < T > ( string databaseName , string collectionName ,
100
- int pageId , int pageSize , SortDefinition < T > sortDefinition , string foreignCollectionName ,
101
- FilterDefinition < T > filter )
102
- {
103
- _logger . LogTrace ( $ "Getting specific items paged of type: { typeof ( T ) } ") ;
104
-
105
- var database = _client . GetDatabase ( databaseName ) ;
106
- var collection = database . GetCollection < T > ( collectionName ) ;
107
- var foreignCollection = database . GetCollection < T > ( foreignCollectionName ) ;
108
-
109
- var result = await collection . Aggregate ( )
110
- . UnionWith ( foreignCollection )
111
- . Match ( filter )
112
- . Sort ( sortDefinition )
113
- . Skip ( pageId * pageSize )
114
- . Limit ( pageSize )
115
- . ToListAsync ( ) ;
116
-
117
- _logger . LogTrace ( $ "Finished getting specific items paged of type: { typeof ( T ) } ") ;
118
-
119
- return result ;
120
- }
121
-
98
+
122
99
public async Task < IEnumerable < T > > GetSpecificPaged < T > ( string databaseName , string collectionName , int pageId ,
123
100
int pageSize ,
124
101
SortDefinition < T > sortDefinition , FilterDefinition < T > filter )
@@ -187,13 +164,13 @@ public async Task<long> CountSpecific<T>(string databaseName, string collectionN
187
164
return result ;
188
165
}
189
166
190
- public async Task < long > CountSpecificFromCollections < T > ( string databaseName , List < string > collectionNames ,
167
+ public async Task < long > CountSpecificFromCollections < T > ( string databaseName , IEnumerable < string > collectionNames ,
191
168
FilterDefinition < T > filter )
192
169
{
193
170
_logger . LogTrace ( $ "Counting all items of type: { typeof ( T ) } in { nameof ( CountSpecificFromCollections ) } ") ;
194
171
195
172
var database = _client . GetDatabase ( databaseName ) ;
196
- var collection = AggregateCollections < T > ( collectionNames , database ) ;
173
+ var collection = AggregateCollections < T > ( collectionNames . ToList ( ) , database ) ;
197
174
198
175
var result = ( await collection . Match ( filter ) . Count ( ) . FirstOrDefaultAsync ( ) ) . Count ;
199
176
0 commit comments