예제 #1
0
        /// <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));
        }
예제 #2
0
        /// <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));
        }
예제 #3
0
 /// <summary>
 /// Adds a mutator for the property named <paramref name="propertyName"/> and specified
 /// <paramref name="newValue"/>.
 /// </summary>
 /// <typeparam name="TVal">The property type.</typeparam>
 /// <param name="propertyName"></param>
 /// <param name="newValue"></param>
 /// <exception cref="MissingMemberException">
 /// Thrown if <paramref name="propertyName"/> is not a property on <typeparamref name="TRecord"/>.
 /// </exception>
 /// <returns>A new API to enable a more fluent API.</returns>
 public ISubsequentPropertyChangeSetApi <TRecord> Mutate <TVal>(string propertyName, TVal newValue)
 {
     return(Mutate(PropertyMutator <TRecord> .FromAssignment(propertyName, newValue)));
 }
예제 #4
0
 /// <summary>
 /// Adds a mutator for the property named <paramref name="propertyName"/> and specified
 /// <paramref name="mutatorFunc"/>.
 /// </summary>
 /// <typeparam name="TVal">The property type.</typeparam>
 /// <param name="propertyName"></param>
 /// <param name="mutatorFunc"></param>
 /// <exception cref="MissingMemberException">
 /// Thrown if <paramref name="propertyName"/> is not a property on <typeparamref name="TRecord"/>.
 /// </exception>
 /// <returns>A new API to enable a more fluent API.</returns>
 public ISubsequentPropertyChangeSetApi <TRecord> Mutate <TVal>(string propertyName, Func <TRecord, TVal> mutatorFunc)
 {
     return(Mutate(PropertyMutator <TRecord> .FromTransform(propertyName, r => mutatorFunc(r))));
 }
예제 #5
0
 /// <summary>
 /// The same as <see cref="PropertyChangeSet{TRecord}.Mutate(PropertyMutator{TRecord})"/>.
 /// </summary>
 /// <param name="mutator"></param>
 /// <returns>this API.</returns>
 public ISubsequentPropertyChangeSetApi <TRecord> AndMutate(PropertyMutator <TRecord> mutator)
 {
     return(Mutate(mutator));
 }
예제 #6
0
 /// <summary>
 /// Adds a mutator to the change set.
 /// </summary>
 /// <param name="mutator"></param>
 /// <returns>A new API to enable a more fluent API.</returns>
 public ISubsequentPropertyChangeSetApi <TRecord> Mutate(PropertyMutator <TRecord> mutator)
 {
     _mutationSet[mutator.PropertyName] = mutator;
     return(this);
 }