Beispiel #1
0
        /// <summary>
        /// Called by RCommon <see cref="Configure"/> to configure state storage.
        /// </summary>
        /// <param name="containerAdapter">The <see cref="IContainerAdapter"/> instance that can be
        /// used to register state storage components.</param>
        public void Configure(IContainerAdapter containerAdapter)
        {
            if (_customSessionType != null)
            {
                containerAdapter.AddTransient(typeof(ISessionState), _customSessionType);
            }
            else
            {
                containerAdapter.AddTransient <ISessionStateSelector, DefaultSessionStateSelector>();
                containerAdapter.AddTransient <ISessionState, SessionStateWrapper>();
            }

            if (_customLocalStateType != null)
            {
                containerAdapter.AddTransient(typeof(IContextState), _customLocalStateType);
            }
            else
            {
                containerAdapter.AddTransient <IContextStateSelector, DefaultContextStateSelector>();
                containerAdapter.AddTransient <IContextState, ContextStateWrapper>();
            }

            if (_customApplicationStateType != null)
            {
                containerAdapter.AddSingleton(typeof(IApplicationState), _customApplicationStateType);
            }
            else
            {
                containerAdapter.AddSingleton <IApplicationState, ApplicationState>();
            }

            containerAdapter.AddTransient <IStateStorage, StateStorageWrapper>();
        }