Example #1
0
        private void InitializeTables()
        {
            List <string> tableNames = _Database.ListTables();

            tableNames = tableNames.ConvertAll(d => d.ToLower());

            if (!tableNames.Contains(USER_TABLE.ToLower()))
            {
                List <Column> userColumns = UserMaster.GetTableColumns();
                _Database.CreateTable(USER_TABLE, userColumns);
            }

            if (!tableNames.Contains(API_KEY_TABLE.ToLower()))
            {
                List <Column> apiKeyColumns = ApiKey.GetTableColumns();
                _Database.CreateTable(API_KEY_TABLE, apiKeyColumns);
            }

            if (!tableNames.Contains(PERMISSION_TABLE.ToLower()))
            {
                List <Column> permissionColumns = Permission.GetTableColumns();
                _Database.CreateTable(PERMISSION_TABLE, permissionColumns);
            }

            if (!tableNames.Contains(LOCKS_TABLE.ToLower()))
            {
                List <Column> locksColumns = UrlLock.GetTableColumns();
                _Database.CreateTable(LOCKS_TABLE, locksColumns);
            }

            if (!tableNames.Contains(CONTAINERS_TABLE.ToLower()))
            {
                List <Column> containerColumns = Container.GetTableColumns();
                _Database.CreateTable(CONTAINERS_TABLE, containerColumns);
            }

            if (!tableNames.Contains(OBJECTS_TABLE.ToLower()))
            {
                List <Column> objectColumns = ObjectMetadata.GetTableColumns();
                _Database.CreateTable(OBJECTS_TABLE, objectColumns);
            }

            if (!tableNames.Contains(CONTAINERS_KVP_TABLE.ToLower()))
            {
                List <Column> containerMetadataColumns = ContainerKeyValuePair.GetTableColumns();
                _Database.CreateTable(CONTAINERS_KVP_TABLE, containerMetadataColumns);
            }

            if (!tableNames.Contains(OBJECTS_KVP_TABLE.ToLower()))
            {
                List <Column> objectMetadataColumns = ObjectKeyValuePair.GetTableColumns();
                _Database.CreateTable(OBJECTS_KVP_TABLE, objectMetadataColumns);
            }

            if (!tableNames.Contains(AUDIT_LOG_TABLE.ToLower()))
            {
                List <Column> auditLogColumns = AuditLogEntry.GetTableColumns();
                _Database.CreateTable(AUDIT_LOG_TABLE, auditLogColumns);
            }
        }