/// <summary> /// Configures a mapping that is based on property value of the object. /// </summary> /// <typeparam name="TSub">Sub type to configure</typeparam> /// <param name="accessor">Lambda expression used to access the sub property.</param> /// <param name="configure">Lambda expression used to configure the mapping.</param> public void Configure <TSub>(Func <T, TSub> accessor, Action <IConfigureChain <TSub> > configure) { SelectorMapper <TSub> mapper = new SelectorMapperSub <T, TSub>(accessor); Selector.AddConditionItem(Condition, mapper); configure(mapper); }
/// <summary> /// Declares that the message will be retrieved via a user specified lambda. /// </summary> /// <param name="accessor">Lambda expression that's given the mapped object and returns a string.</param> /// <returns>Fluent Interface</returns> public IConditionalUseMessage <T> UseMessage(Func <T, string> accessor) { MessageProcessor <T> messageProcessor = new MessageProcessor <T>(accessor); Selector.AddConditionItem(Condition, messageProcessor); return(new ConditionalRelayMessage <T>(Selector, messageProcessor)); }
/// <summary> /// Configures the current mapping using the current type value. /// </summary> /// <param name="configure">Lambda express used to configure the mapped type.</param> public void Configure(Action <IConfigureChain <T> > configure) { SelectorMapper <T> mapper = new SelectorMapper <T>(); Selector.AddConditionItem(Condition, mapper); configure(mapper); }
/// <summary> /// Declares that the message should come from the resources /// with the specified key. /// </summary> /// <param name="resourceKey">string: resource string table key.</param> /// <returns>Fluent Interface</returns> public IConditionalUseMessage <T> UseMessage(string resourceKey) { MessageProcessor <T> messageProcessor = new MessageProcessor <T>(resourceKey); Selector.AddConditionItem(Condition, messageProcessor); return(new ConditionalRelayMessage <T>(Selector, messageProcessor)); }