Example #1
0
        public static async Task BuildAsync(
            Catalog catalog,
            DbConnection connection,
            IMetadataScriptFactory metadataScriptFactory,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken.ThrowIfCancellationRequested();
            var userTables = await GetAsync(catalog, connection, metadataScriptFactory, cancellationToken);

            if (userTables.Count == 0)
            {
                return;
            }

            await UserTableColumnAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);

            var primaryKeyColumns = await PrimaryKeyAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);

            var uniqueConstraintColumns = await UniqueConstraintAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);

            await ForeignKeyAdapter.GetAsync(catalog, userTables, primaryKeyColumns, uniqueConstraintColumns, connection, metadataScriptFactory, cancellationToken);

            await ComputedColumnsAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);

            await DefaultConstraintAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);

            await CheckConstraintAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);

            await IdentityColumnAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);

            await IndexAdapter.GetAsync(catalog, userTables, connection, metadataScriptFactory, cancellationToken);
        }
Example #2
0
        public static void Build(
            Catalog catalog,
            DbConnection connection,
            IMetadataScriptFactory metadataScriptFactory)
        {
            var userTables = Get(catalog, connection, metadataScriptFactory);

            if (userTables.Count == 0)
            {
                return;
            }

            UserTableColumnAdapter.Get(catalog, userTables, connection, metadataScriptFactory);
            var primaryKeyColumns       = PrimaryKeyAdapter.Get(catalog, userTables, connection, metadataScriptFactory);
            var uniqueConstraintColumns = UniqueConstraintAdapter.Get(catalog, userTables, connection, metadataScriptFactory);

            ForeignKeyAdapter.Get(catalog, userTables, primaryKeyColumns, uniqueConstraintColumns, connection, metadataScriptFactory);
            ComputedColumnsAdapter.Get(catalog, userTables, connection, metadataScriptFactory);
            DefaultConstraintAdapter.Get(catalog, userTables, connection, metadataScriptFactory);
            CheckConstraintAdapter.Get(catalog, userTables, connection, metadataScriptFactory);
            IdentityColumnAdapter.Get(catalog, userTables, connection, metadataScriptFactory);
            IndexAdapter.Get(catalog, userTables, connection, metadataScriptFactory);
        }