Esempio n. 1
0
        /// <summary>
        /// Configures the Default handler.
        /// </summary>
        /// <typeparam name="TSub">The new type</typeparam>
        /// <typeparam name="TParent">the current parent type</typeparam>
        /// <param name="accessor">Lambda expression that access the property message lookup.</param>
        /// <param name="configure">Lambda expression that configures the mapping</param>
        public void ConfigureDefault <TSub>(Action <IConfigureChain <TSub> > configure,
                                            LookupStrategyEnum lookupStrategy = LookupStrategyEnum.ConcreteOnly)
        {
            SelectorMapper <TSub> mapper = new SelectorMapper <TSub>(lookupStrategy);

            DefaultItem = mapper;
            configure(mapper);
        }
Esempio n. 2
0
        /// <summary>
        /// Configure using the current type. This is special because
        /// it has not accessor to get at the sub property type.
        /// </summary>
        /// <typeparam name="TSub">The new type</typeparam>
        /// <param name="configure">Lambda expression that configures the mapping</param>
        /// <param name="lookupStrategy">The mapper's lookup strategy.</param>
        public void Configure <TSub>(Action <IConfigureChain <TSub> > configure,
                                     LookupStrategyEnum lookupStrategy    = LookupStrategyEnum.ConcreteOnly,
                                     string typeNameResourceKey           = "",
                                     Func <TSub, string> TypeNameAccessor = null)
        {
            SelectorMapper <TSub> mapper = new SelectorMapper <TSub>(lookupStrategy)
            {
                TypeNameResourceKey = typeNameResourceKey,
                TypeNameAccessor    = TypeNameAccessor
            };

            Mapper.Add <TSub>(mapper);
            configure(mapper);
        }