Exemplo n.º 1
0
        public IStoreConfiguration <TState> UseLogger <TLogType, TOptionsType>(ConfigurationDelegate <TOptionsType>?options = null)
            where TLogType : ILog
            where TOptionsType : new()
        {
            IParameter parameter = CreateFactoryParameter(options);

            m_loggerTypeRequest = new TypeRequest(typeof(TLogType), typeof(ILog), parameter);
            return(this);
        }
Exemplo n.º 2
0
        public IStoreConfiguration <TState> UseMiddleware <TType, TOptionsType>(ConfigurationDelegate <TOptionsType>?options = null)
            where TOptionsType : new()
            where TType : IAbstractMiddleware
        {
            IParameter parameter = CreateFactoryParameter(options);

            m_middleware.Add(new TypeRequest(typeof(TType), parameter));
            return(this);
        }
Exemplo n.º 3
0
 private IParameter CreateFactoryParameter <TOptionsType>(ConfigurationDelegate <TOptionsType>?options = null)
     where TOptionsType : new()
 {
     return(new FactoryParameter <TOptionsType>(nameof(options), () =>
     {
         TOptionsType instance = new();
         options?.Invoke(instance);
         return instance;
     }));
 }
Exemplo n.º 4
0
        public IStoreConfiguration <TState> UseRootReducer <TReducerType, TOptionsType>(ConfigurationDelegate <TOptionsType>?options = null)
            where TOptionsType : new()
            where TReducerType : IAbstractReducer <TState>
        {
            IParameter parameter = CreateFactoryParameter(options);

            m_reducers.Add(new TypeRequest(typeof(TReducerType), parameter));
            return(this);
        }
Exemplo n.º 5
0
        public IStoreConfiguration <TState> UseSingleton <TInstanceType, TBindAs, TOptionsType>(ConfigurationDelegate <TOptionsType>?options = null)
            where TInstanceType : TBindAs
            where TOptionsType : new()
        {
            IParameter parameter = CreateFactoryParameter(options);

            m_singletonTypeRequests.Add(new TypeRequest(typeof(TInstanceType), typeof(TBindAs), parameter));
            return(this);
        }
Exemplo n.º 6
0
        public IStoreConfiguration <TState> UseActivator <TActivatorType, TOptionsType>(ConfigurationDelegate <TOptionsType>?options = null)
            where TOptionsType : new()
        {
            IParameter parameter = CreateFactoryParameter(options);

            m_activatorTypeRequest = new TypeRequest(typeof(TActivatorType), parameter);
            return(this);
        }
Exemplo n.º 7
0
        public IStoreConfiguration <TState> UseReducer <TReducerType, TSectionType, TOptions>(Expression <StateSubSectionSelectionDelegate <TState, TSectionType> > sectionSelector, ConfigurationDelegate <TOptions> options)
            where TOptions : new()
            where TReducerType : IReducer <TSectionType>
        {
            Type reducerType = typeof(ReducerSection <TState, TReducerType, TSectionType>);

            IParameter[] parameters = new IParameter[]
            {
                CreateFactoryParameter(options),
                ConstantParameter.Create <ITypeRequest>("subReducer", new TypeRequest(typeof(TReducerType))),
                new ConstantParameter(nameof(sectionSelector), sectionSelector, typeof(Expression <StateSubSectionSelectionDelegate <TReducerType, TSectionType> >))
            };
            TypeRequest typeRequest = new TypeRequest(reducerType, parameters);

            m_reducers.Add(typeRequest);
            return(this);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Adds the ability for a remote Redux Dev Tools Monitor to connect to this instance and interact with it.
 /// </summary>
 /// <typeparam name="T">The root state type</typeparam>
 /// <param name="buidler">The current builder allowing for chaining of requests</param>
 /// <returns>The configuration sent in</returns>
 public static IStoreConfiguration <T> UseReduxDevTools <T>(this IStoreConfiguration <T> builder, ConfigurationDelegate <DevToolsOptions> options = null)
 {
     builder.UseSingleton <ReduxConnection, DevToolsOptions>(options);
     builder.UseMiddleware <Middleware <T>, DevToolsOptions>(options);
     builder.UseRootReducer <Reducer <T>, DevToolsOptions>(options);
     return(builder);
 }