public static PersistenceSpecification <T> CheckComponentList <T, TListElement>(this PersistenceSpecification <T> spec, Expression <Func <T, IEnumerable <TListElement> > > expression, IEnumerable <TListElement> propertyValue, IEqualityComparer elementComparer, Action <T, TListElement> listItemSetter) { Accessor property = ReflectionHelper.GetAccessor(expression); var list = new List <T, TListElement>(property, propertyValue); list.ValueSetter = (target, propertyInfo, value) => { foreach (var item in value) { listItemSetter(target, item); } }; return(spec.RegisterCheckedProperty(list, elementComparer)); }
/// <summary> /// Checks a list of components for validity. /// </summary> /// <typeparam name="T">Entity type</typeparam> /// <typeparam name="TListElement">Type of list element</typeparam> /// <param name="spec">Persistence specification</param> /// <param name="expression">Property</param> /// <param name="propertyValue">Value to save</param> /// <param name="elementComparer">Equality comparer</param> public static PersistenceSpecification <T> CheckComponentList <T, TListElement>(this PersistenceSpecification <T> spec, Expression <Func <T, object> > expression, IEnumerable <TListElement> propertyValue, IEqualityComparer elementComparer) { Accessor property = ReflectionHelper.GetAccessor(expression); return(spec.RegisterCheckedProperty(new List <T, TListElement>(property, propertyValue), elementComparer)); }
public static PersistenceSpecification <T> CheckComponentList <T, TListElement>(this PersistenceSpecification <T> spec, Expression <Func <T, IEnumerable <TListElement> > > expression, IEnumerable <TListElement> propertyValue, Action <T, TListElement> listItemSetter) { return(spec.CheckComponentList(expression, propertyValue, null, listItemSetter)); }
public static PersistenceSpecification <T> CheckProperty <T>(this PersistenceSpecification <T> spec, Expression <Func <T, object> > expression, object propertyValue) { return(spec.CheckProperty(expression, propertyValue, (IEqualityComparer)null)); }
public static PersistenceSpecification <T> CheckBag <T, TListElement>(this PersistenceSpecification <T> spec, Expression <Func <T, IEnumerable <TListElement> > > expression, IEnumerable <TListElement> propertyValue) { return(spec.CheckBag(expression, propertyValue, (IEqualityComparer)null)); }
public static PersistenceSpecification <T> CheckProperty <T, TListElement>(this PersistenceSpecification <T> spec, Expression <Func <T, Array> > expression, IEnumerable <TListElement> propertyValue) { return(spec.CheckProperty(expression, propertyValue, null)); }
public static PersistenceSpecification <T> CheckInverseList <T, TListElement>(this PersistenceSpecification <T> spec, Expression <Func <T, IEnumerable <TListElement> > > expression, IEnumerable <TListElement> propertyValue, params Func <TListElement, object>[] propertiesToCompare) { // Because of the params keyword, the compiler can select this overload // instead of the one above, even when no funcs are supplied in the method call. if (propertiesToCompare == null || propertiesToCompare.Length == 0) { return(spec.CheckList(expression, propertyValue, (IEqualityComparer)null)); } return(spec.CheckInverseList(expression, propertyValue, new FuncEqualityComparer <TListElement>(propertiesToCompare))); }
public static PersistenceSpecification <T> CheckInverseList <T, TListElement>(this PersistenceSpecification <T> spec, Expression <Func <T, IEnumerable <TListElement> > > expression, IEnumerable <TListElement> propertyValue, IEqualityComparer elementComparer) { Accessor property = ReflectionHelper.GetAccessor(expression); return(spec.RegisterCheckedPropertyWithoutTransactionalSave(new ReferenceList <T, TListElement>(property, propertyValue), elementComparer)); }