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); }
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); }
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; })); }
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); }
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); }
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); }
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); }
/// <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); }