示例#1
0
        public override IReadOnlyList <MigrationCommand> Generate(IReadOnlyList <MigrationOperation> operations, IModel model = null)
        {
            Check.NotNull(operations, nameof(operations));

            var builder = new MigrationCommandListBuilder(_commandBuilderFactory);

            foreach (var operation in operations)
            {
                Generate(operation, model, builder);
                builder
                .EndCommand();
            }
            var list = builder.GetCommandList();

            //HACK to force logging of migration SQL
            foreach (var migrationCommand in list)
            {
                if (!string.IsNullOrEmpty(migrationCommand.CommandText))
                {
                    //TODO ErikEJ Investigate how to fix this?
                    //_logger.Logger.LogCommandExecuted(new SqlCeCommand(migrationCommand.CommandText), Stopwatch.GetTimestamp(), Stopwatch.GetTimestamp());
                }
            }
            return(list);
        }
        public override IReadOnlyList<MigrationCommand> Generate(IReadOnlyList<MigrationOperation> operations, IModel model = null)
        {
            var builder = new MigrationCommandListBuilder(Dependencies);
            var orderedOperations = operations.OrderBy(c => c, new MigrationOpComparer());
            foreach (var operation in orderedOperations)
            {
                Generate(operation, model, builder);
            }

            return builder.GetCommandList();
        }
        public virtual IReadOnlyList<MigrationCommand> Generate(
            IReadOnlyList<MigrationOperation> operations,
            IModel model = null)
        {
            Check.NotNull(operations, nameof(operations));

            var builder = new MigrationCommandListBuilder(_commandBuilderFactory);
            foreach (var operation in operations)
            {
                Generate(operation, model, builder);
            }

            return builder.GetCommandList();
        }
        public virtual IReadOnlyList <MigrationCommand> Generate(
            IReadOnlyList <MigrationOperation> operations,
            IModel model = null)
        {
            Check.NotNull(operations, nameof(operations));

            var builder = new MigrationCommandListBuilder(Dependencies.CommandBuilderFactory);

            foreach (var operation in operations)
            {
                Generate(operation, model, builder);
            }

            return(builder.GetCommandList());
        }
        public override IReadOnlyList <MigrationCommand> Generate(IReadOnlyList <MigrationOperation> operations, IModel model = null)
        {
            Check.NotNull(operations, nameof(operations));

            var builder = new MigrationCommandListBuilder(_commandBuilderFactory);

            foreach (var operation in operations)
            {
                Generate(operation, model, builder);
                builder
                .EndCommand();
            }
            var list = builder.GetCommandList();

            return(list);
        }
        public override IReadOnlyList <MigrationCommand> Generate(IReadOnlyList <MigrationOperation> operations, IModel model = null)
        {
            var builder           = new MigrationCommandListBuilder(Dependencies);
            var orderedOperations = operations.OrderBy(c => c, new MigrationOpComparer());

            if (operations.Any(o => o is DropTableOperation))
            {
                orderedOperations = operations.OrderByDescending(c => c, new MigrationOpComparer());
            }

            foreach (var operation in orderedOperations)
            {
                Generate(operation, model, builder);
            }

            return(builder.GetCommandList());
        }