@@ -250,6 +250,167 @@ public static PersistenceSpecification<T> CheckList<T, TListElement>(this Persis
250
250
return spec . RegisterCheckedProperty ( list , elementComparer ) ;
251
251
}
252
252
253
+
254
+ public static PersistenceSpecification < T > CheckInverseBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
255
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
256
+ IEnumerable < TListElement > propertyValue )
257
+ {
258
+ return spec . CheckInverseBag ( expression , propertyValue , ( IEqualityComparer ) null ) ;
259
+ }
260
+
261
+ public static PersistenceSpecification < T > CheckInverseBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
262
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
263
+ IEnumerable < TListElement > propertyValue ,
264
+ IEqualityComparer elementComparer )
265
+ {
266
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
267
+
268
+ return spec . RegisterCheckedPropertyWithoutTransactionalSave ( new ReferenceBag < T , TListElement > ( property , propertyValue ) , elementComparer ) ;
269
+ }
270
+
271
+ public static PersistenceSpecification < T > CheckInverseBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
272
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
273
+ IEnumerable < TListElement > propertyValue ,
274
+ params Func < TListElement , object > [ ] propertiesToCompare )
275
+ {
276
+ // Because of the params keyword, the compiler can select this overload
277
+ // instead of the one above, even when no funcs are supplied in the method call.
278
+ if ( propertiesToCompare == null || propertiesToCompare . Length == 0 )
279
+ return spec . CheckInverseBag ( expression , propertyValue , ( IEqualityComparer ) null ) ;
280
+
281
+ return spec . CheckInverseBag ( expression , propertyValue , new FuncEqualityComparer < TListElement > ( propertiesToCompare ) ) ;
282
+ }
283
+
284
+ public static PersistenceSpecification < T > CheckInverseBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
285
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
286
+ IEnumerable < TListElement > propertyValue ,
287
+ Action < T , TListElement > listItemSetter )
288
+ {
289
+ return spec . CheckInverseBag ( expression , propertyValue , null , listItemSetter ) ;
290
+ }
291
+
292
+ public static PersistenceSpecification < T > CheckInverseBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
293
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
294
+ IEnumerable < TListElement > propertyValue ,
295
+ Action < T , IEnumerable < TListElement > > listSetter )
296
+ {
297
+ return spec . CheckInverseBag ( expression , propertyValue , null , listSetter ) ;
298
+ }
299
+
300
+ public static PersistenceSpecification < T > CheckInverseBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
301
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
302
+ IEnumerable < TListElement > propertyValue ,
303
+ IEqualityComparer elementComparer ,
304
+ Action < T , TListElement > listItemSetter )
305
+ {
306
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
307
+
308
+ var list = new ReferenceBag < T , TListElement > ( property , propertyValue ) ;
309
+ list . ValueSetter = ( target , propertyInfo , value ) =>
310
+ {
311
+ foreach ( var item in value )
312
+ {
313
+ listItemSetter ( target , item ) ;
314
+ }
315
+ } ;
316
+
317
+ return spec . RegisterCheckedPropertyWithoutTransactionalSave ( list , elementComparer ) ;
318
+ }
319
+
320
+ public static PersistenceSpecification < T > CheckInverseBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
321
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
322
+ IEnumerable < TListElement > propertyValue ,
323
+ IEqualityComparer elementComparer ,
324
+ Action < T , IEnumerable < TListElement > > listSetter )
325
+ {
326
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
327
+
328
+ var list = new ReferenceBag < T , TListElement > ( property , propertyValue ) ;
329
+ list . ValueSetter = ( target , propertyInfo , value ) => listSetter ( target , value ) ;
330
+
331
+ return spec . RegisterCheckedPropertyWithoutTransactionalSave ( list , elementComparer ) ;
332
+ }
333
+
334
+ public static PersistenceSpecification < T > CheckBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
335
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
336
+ IEnumerable < TListElement > propertyValue )
337
+ {
338
+ return spec . CheckBag ( expression , propertyValue , ( IEqualityComparer ) null ) ;
339
+ }
340
+
341
+ public static PersistenceSpecification < T > CheckBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
342
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
343
+ IEnumerable < TListElement > propertyValue ,
344
+ IEqualityComparer elementComparer )
345
+ {
346
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
347
+
348
+ return spec . RegisterCheckedProperty ( new ReferenceBag < T , TListElement > ( property , propertyValue ) , elementComparer ) ;
349
+ }
350
+
351
+ public static PersistenceSpecification < T > CheckBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
352
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
353
+ IEnumerable < TListElement > propertyValue ,
354
+ params Func < TListElement , object > [ ] propertiesToCompare )
355
+ {
356
+ // Because of the params keyword, the compiler can select this overload
357
+ // instead of the one above, even when no funcs are supplied in the method call.
358
+ if ( propertiesToCompare == null || propertiesToCompare . Length == 0 )
359
+ return spec . CheckBag ( expression , propertyValue , ( IEqualityComparer ) null ) ;
360
+
361
+ return spec . CheckBag ( expression , propertyValue , new FuncEqualityComparer < TListElement > ( propertiesToCompare ) ) ;
362
+ }
363
+
364
+ public static PersistenceSpecification < T > CheckBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
365
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
366
+ IEnumerable < TListElement > propertyValue ,
367
+ Action < T , TListElement > listItemSetter )
368
+ {
369
+ return spec . CheckBag ( expression , propertyValue , null , listItemSetter ) ;
370
+ }
371
+
372
+ public static PersistenceSpecification < T > CheckBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
373
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
374
+ IEnumerable < TListElement > propertyValue ,
375
+ Action < T , IEnumerable < TListElement > > listSetter )
376
+ {
377
+ return spec . CheckBag ( expression , propertyValue , null , listSetter ) ;
378
+ }
379
+
380
+ public static PersistenceSpecification < T > CheckBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
381
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
382
+ IEnumerable < TListElement > propertyValue ,
383
+ IEqualityComparer elementComparer ,
384
+ Action < T , TListElement > listItemSetter )
385
+ {
386
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
387
+
388
+ var list = new ReferenceBag < T , TListElement > ( property , propertyValue ) ;
389
+ list . ValueSetter = ( target , propertyInfo , value ) =>
390
+ {
391
+ foreach ( var item in value )
392
+ {
393
+ listItemSetter ( target , item ) ;
394
+ }
395
+ } ;
396
+
397
+ return spec . RegisterCheckedProperty ( list , elementComparer ) ;
398
+ }
399
+
400
+ public static PersistenceSpecification < T > CheckBag < T , TListElement > ( this PersistenceSpecification < T > spec ,
401
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
402
+ IEnumerable < TListElement > propertyValue ,
403
+ IEqualityComparer elementComparer ,
404
+ Action < T , IEnumerable < TListElement > > listSetter )
405
+ {
406
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
407
+
408
+ var list = new ReferenceBag < T , TListElement > ( property , propertyValue ) ;
409
+ list . ValueSetter = ( target , propertyInfo , value ) => listSetter ( target , value ) ;
410
+
411
+ return spec . RegisterCheckedProperty ( list , elementComparer ) ;
412
+ }
413
+
253
414
public static PersistenceSpecification < T > CheckComponentList < T , TListElement > ( this PersistenceSpecification < T > spec ,
254
415
Expression < Func < T , object > > expression ,
255
416
IEnumerable < TListElement > propertyValue )
0 commit comments