/// <summary>
        /// Creates a temporary data provider.
        /// </summary>
        ///
        /// <returns>
        /// A temporary data provider.
        /// </returns>
        protected virtual ITempDataProvider CreateTempDataProvider()
        {
            ITempDataProviderFactory service = Resolver.GetService <ITempDataProviderFactory>();

            if (service != null)
            {
                return(service.CreateInstance());
            }
            return(Resolver.GetService <ITempDataProvider>() ?? new SessionStateTempDataProvider());
        }
Exemple #2
0
        protected virtual ITempDataProvider CreateTempDataProvider()
        {
            // The factory can be customized in order to create an ITempDataProvider for the controller.
            ITempDataProviderFactory tempDataProviderFactory = Resolver.GetService <ITempDataProviderFactory>();

            if (tempDataProviderFactory != null)
            {
                return(tempDataProviderFactory.CreateInstance());
            }

            // Note that getting a service from the current cache will return the same instance for every controller.
            return(Resolver.GetService <ITempDataProvider>() ?? new SessionStateTempDataProvider());
        }