public override void Initialize(string name, NameValueCollection config)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = "CosmosDb session state provider";
            }

            base.Initialize(name, config);

            // Don't ask me why it is prefixed with "x", if you name it just lockTtlSeconds it would fail without an error message.
            var lockTtlSeconds = config.GetInt32("xLockTtlSeconds", 30);

            var consistencyLevel = config.GetEnum("consistencyLevel", ConsistencyLevel.Strong);

            var databaseId = config.GetRequiredString("databaseId");

            var compressionEnabled = config.GetBoolean("compressionEnabled", true);

            var connectionString = config.GetRequiredString("connectionString");

            // ReSharper disable once HeapView.CanAvoidClosure
            _store = Databases.GetOrAdd(name, n => new Lazy <ISessionDatabase>(
                                            () =>
            {
                var db = new CosmosSessionDatabase(connectionString, databaseId,
                                                   lockTtlSeconds, compressionEnabled, consistencyLevel);
                db.Initialize();
                return(db);
            },
                                            LazyThreadSafetyMode.PublicationOnly))
                     .Value;
        }
        private static CosmosSessionDatabase CreateDatabase()
        {
            var emulatorConnectionString =
                @"AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
            var db = new CosmosSessionDatabase(emulatorConnectionString, "testdb", LockTtlSeconds, true,
                                               ConsistencyLevel.Session);

            db.Initialize();
            return(db);
        }