Пример #1
0
        public CSharpMigrationsGenerator(
            [NotNull] CSharpHelper codeHelper,
            [NotNull] CSharpMigrationOperationGenerator operationGenerator,
            [NotNull] CSharpSnapshotGenerator modelGenerator)
        {
            Check.NotNull(codeHelper, nameof(codeHelper));
            Check.NotNull(operationGenerator, nameof(operationGenerator));
            Check.NotNull(modelGenerator, nameof(modelGenerator));

            _code = codeHelper;
            _operationGenerator = operationGenerator;
            _modelGenerator     = modelGenerator;
        }
Пример #2
0
        private MigrationsScaffolder CreateMigrationScaffolder <TContext>()
            where TContext : DbContext, new()
        {
            var context     = new TContext();
            var idGenerator = new MigrationsIdGenerator();
            var code        = new CSharpHelper();

            return(new MigrationsScaffolder(
                       context,
                       new Model(),
                       new MigrationsAssembly(
                           context,
                           new DbContextOptions <TContext>().WithExtension(new MockRelationalOptionsExtension()),
                           idGenerator),
                       new MigrationsModelDiffer(
                           new TestAnnotationProvider(),
                           new MigrationsAnnotationProvider()),
                       idGenerator,
                       new CSharpMigrationsGenerator(code, new CSharpMigrationOperationGenerator(code), new CSharpSnapshotGenerator(code)),
                       new MockHistoryRepository(),
                       new LoggerFactory(),
                       new MockProviderServices()));
        }
Пример #3
0
        public void Literal_works(object value, string expected)
        {
            var literal = new CSharpHelper().UnknownLiteral(value);

            Assert.Equal(expected, literal);
        }
Пример #4
0
        public void Literal_works_when_many_StringArray()
        {
            var literal = new CSharpHelper().Literal(new[] { "A", "B" });

            Assert.Equal("new[] { \"A\", \"B\" }", literal);
        }
Пример #5
0
        public void Literal_works_when_single_StringArray()
        {
            var literal = new CSharpHelper().Literal(new[] { "A" });

            Assert.Equal("\"A\"", literal);
        }
Пример #6
0
        public CSharpSnapshotGenerator([NotNull] CSharpHelper codeHelper)
        {
            Check.NotNull(codeHelper, nameof(codeHelper));

            _code = codeHelper;
        }
        public CSharpMigrationOperationGenerator([NotNull] CSharpHelper codeHelper)
        {
            Check.NotNull(codeHelper, nameof(codeHelper));

            _code = codeHelper;
        }