@@ -148,6 +148,29 @@ public static PersistenceSpecification<T> CheckList<T, TListElement>(this Persis
148
148
return spec . CheckList ( expression , propertyValue , new FuncEqualityComparer < TListElement > ( propertiesToCompare ) ) ;
149
149
}
150
150
151
+ public static PersistenceSpecification < T > CheckInverseList < T , TListElement > ( this PersistenceSpecification < T > spec ,
152
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
153
+ IEnumerable < TListElement > propertyValue ,
154
+ IEqualityComparer elementComparer )
155
+ {
156
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
157
+
158
+ return spec . RegisterCheckedPropertyWithoutTransactionalSave ( new ReferenceList < T , TListElement > ( property , propertyValue ) , elementComparer ) ;
159
+ }
160
+
161
+ public static PersistenceSpecification < T > CheckInverseList < T , TListElement > ( this PersistenceSpecification < T > spec ,
162
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
163
+ IEnumerable < TListElement > propertyValue ,
164
+ params Func < TListElement , object > [ ] propertiesToCompare )
165
+ {
166
+ // Because of the params keyword, the compiler can select this overload
167
+ // instead of the one above, even when no funcs are supplied in the method call.
168
+ if ( propertiesToCompare == null || propertiesToCompare . Length == 0 )
169
+ return spec . CheckList ( expression , propertyValue , ( IEqualityComparer ) null ) ;
170
+
171
+ return spec . CheckInverseList ( expression , propertyValue , new FuncEqualityComparer < TListElement > ( propertiesToCompare ) ) ;
172
+ }
173
+
151
174
public static PersistenceSpecification < T > CheckList < T , TListElement > ( this PersistenceSpecification < T > spec ,
152
175
Expression < Func < T , IEnumerable < TListElement > > > expression ,
153
176
IEnumerable < TListElement > propertyValue ,
@@ -156,6 +179,34 @@ public static PersistenceSpecification<T> CheckList<T, TListElement>(this Persis
156
179
return spec . CheckList ( expression , propertyValue , null , listItemSetter ) ;
157
180
}
158
181
182
+ public static PersistenceSpecification < T > CheckInverseList < T , TListElement > ( this PersistenceSpecification < T > spec ,
183
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
184
+ IEnumerable < TListElement > propertyValue ,
185
+ Action < T , TListElement > listItemSetter )
186
+ {
187
+ return spec . CheckInverseList ( expression , propertyValue , null , listItemSetter ) ;
188
+ }
189
+
190
+ public static PersistenceSpecification < T > CheckInverseList < T , TListElement > ( this PersistenceSpecification < T > spec ,
191
+ Expression < Func < T , IEnumerable < TListElement > > > expression ,
192
+ IEnumerable < TListElement > propertyValue ,
193
+ IEqualityComparer elementComparer ,
194
+ Action < T , TListElement > listItemSetter )
195
+ {
196
+ Accessor property = ReflectionHelper . GetAccessor ( expression ) ;
197
+
198
+ var list = new ReferenceList < T , TListElement > ( property , propertyValue ) ;
199
+ list . ValueSetter = ( target , propertyInfo , value ) =>
200
+ {
201
+ foreach ( var item in value )
202
+ {
203
+ listItemSetter ( target , item ) ;
204
+ }
205
+ } ;
206
+
207
+ return spec . RegisterCheckedPropertyWithoutTransactionalSave ( list , elementComparer ) ;
208
+ }
209
+
159
210
public static PersistenceSpecification < T > CheckList < T , TListElement > ( this PersistenceSpecification < T > spec ,
160
211
Expression < Func < T , IEnumerable < TListElement > > > expression ,
161
212
IEnumerable < TListElement > propertyValue ,
0 commit comments