/// <summary> /// Adds a mutator for the property pointed to by <paramref name="propertyAccessor"/> and /// specified <paramref name="mutatorFunc"/> . /// </summary> /// <typeparam name="TVal">The property type.</typeparam> /// <param name="propertyAccessor"></param> /// <param name="mutatorFunc"></param> /// <returns>A new API to enable a more fluent API.</returns> public ISubsequentPropertyChangeSetApi <TRecord> Mutate <TVal>(Expression <Func <TRecord, TVal> > propertyAccessor, Func <TRecord, TVal> mutatorFunc) { var propertyInfo = PropertyMutator <TRecord> .GetPropertyFromExpression(propertyAccessor); var mutator = PropertyMutator <TRecord> .FromTransform(propertyInfo, r => mutatorFunc(r)); return(Mutate(mutator)); }
/// <summary> /// Adds a mutator for the property pointed to by <paramref name="propertyAccessor"/> and /// specified <paramref name="newValue"/>. /// </summary> /// <typeparam name="TVal">The property type.</typeparam> /// <param name="propertyAccessor"></param> /// <param name="newValue"></param> /// <returns>A new API to enable a more fluent API.</returns> public ISubsequentPropertyChangeSetApi <TRecord> Mutate <TVal>(Expression <Func <TRecord, TVal> > propertyAccessor, TVal newValue) { var propertyInfo = PropertyMutator <TRecord> .GetPropertyFromExpression(propertyAccessor); var mutator = PropertyMutator <TRecord> .FromAssignment(propertyInfo, newValue); return(Mutate(mutator)); }