Amazon.SessionProvider.DynamoDBSessionStateStore.GetConfigSettings C# (CSharp) Méthode

GetConfigSettings() private méthode

private GetConfigSettings ( NameValueCollection config ) : void
config System.Collections.Specialized.NameValueCollection
Résultat void
        private void GetConfigSettings(NameValueCollection config)
        {
            this._accessKey = config[CONFIG_ACCESSKEY];
            this._secretKey = config[CONFIG_SECRETKEY];
            this._regionName = config[CONFIG_REGION];

            if (string.IsNullOrEmpty(this._regionName))
            {
                throw new AmazonDynamoDBException("No region found. Region is required to be specified in the web.config");
            }

            if (!string.IsNullOrEmpty(config[CONFIG_TABLE]))
            {
                this._tableName = config[CONFIG_TABLE];
            }

            if (!string.IsNullOrEmpty(config[CONFIG_APPLICATION]))
            {
                this._application = config[CONFIG_APPLICATION];
            }

            if (!string.IsNullOrEmpty(config[CONFIG_CREATE_TABLE_IF_NOT_EXIST]))
            {
                this._createIfNotExist = bool.Parse(config[CONFIG_CREATE_TABLE_IF_NOT_EXIST]);
            }

            if (!string.IsNullOrEmpty(config[CONFIG_INITIAL_READ_UNITS]))
            {
                this._initialReadUnits = int.Parse(config[CONFIG_INITIAL_READ_UNITS]);
            }

            if (!string.IsNullOrEmpty(config[CONFIG_INITIAL_WRITE_UNITS]))
            {
                this._initialWriteUnits = int.Parse(config[CONFIG_INITIAL_WRITE_UNITS]);
            }


            string applicationName = System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath;
            if (applicationName != null)
            {
                Configuration cfg = WebConfigurationManager.OpenWebConfiguration(applicationName);
                if (cfg != null)
                {
                    SessionStateSection sessionConfig = cfg.GetSection("system.web/sessionState") as SessionStateSection;
                    if (sessionConfig != null)
                    {
                        this._timeout = sessionConfig.Timeout;
                    }
                }
            }
        }