Amazon.SessionProvider.DynamoDBSessionStateStore.ValidateTable C# (CSharp) Method

ValidateTable() private method

Make sure existing table is valid to be used as a session store.
private ValidateTable ( ) : void
return void
        private void ValidateTable()
        {
            if (this._table.HashKeys.Count != 1)
                throw new AmazonDynamoDBException(string.Format("Table {0} cannot be used to store session data because it does not define a single hash key", this._tableName));
            string hashKey = this._table.HashKeys[0];
            KeyDescription hashKeyDescription = this._table.Keys[hashKey];
            if (hashKeyDescription.Type != DynamoDBEntryType.String)
                throw new AmazonDynamoDBException(string.Format("Table {0} cannot be used to store session data because hash key is not a string.", this._tableName));

            if (this._table.RangeKeys.Count > 0)
                throw new AmazonDynamoDBException(string.Format("Table {0} cannot be used to store session data because it contains a range key in its schema.", this._tableName));

            ATTRIBUTE_SESSION_ID = hashKey;
        }