/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public EntityTypeWriter( [NotNull] CSharpUtilities cSharpUtilities) { Check.NotNull(cSharpUtilities, nameof(cSharpUtilities)); CSharpUtilities = cSharpUtilities; }
private void ValidateContextNameInReverseEngineerGenerator(string contextName) { var cSharpUtilities = new CSharpUtilities(); var reverseEngineer = new ReverseEngineerScaffolder( new RelationalDatabaseModelFactoryTest.FakeDatabaseModelFactory(), new RelationalDatabaseModelFactoryTest.FakeScaffoldingModelFactory(new TestOperationReporter()), new CSharpScaffoldingGenerator( new InMemoryFileService(), new CSharpDbContextGenerator(new FakeScaffoldingCodeGenerator(), new FakeAnnotationCodeGenerator(), cSharpUtilities), new CSharpEntityTypeGenerator(cSharpUtilities)), cSharpUtilities); Assert.Equal( DesignStrings.ContextClassNotValidCSharpIdentifier(contextName), Assert.Throws <ArgumentException>( () => reverseEngineer.Generate( connectionString: "connectionstring", tables: Enumerable.Empty <string>(), schemas: Enumerable.Empty <string>(), projectPath: "FakeProjectPath", outputPath: null, rootNamespace: "FakeNamespace", contextName: contextName, useDataAnnotations: false, overwriteFiles: false, useDatabaseNames: false)) .Message); }
public void Generate_MethodCallCodeFragment_works_when_niladic() { var method = new MethodCallCodeFragment("Test"); var result = new CSharpUtilities().Generate(method); Assert.Equal(".Test()", result); }
public void Generate_MethodCallCodeFragment_works_with_arrays() { var method = new MethodCallCodeFragment("Test", new byte[] { 1, 2 }, new[] { 3, 4 }, new[] { "foo", "bar" }); var result = new CSharpUtilities().Generate(method); Assert.Equal(".Test(new byte[] { 1, 2 }, new int[] { 3, 4 }, new string[] { \"foo\", \"bar\" })", result); }
public void Generate_MethodCallCodeFragment_works() { var method = new MethodCallCodeFragment("Test", true, 42); var result = new CSharpUtilities().Generate(method); Assert.Equal(".Test(true, 42)", result); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public DbContextWriter( [NotNull] ScaffoldingUtilities scaffoldingUtilities, [NotNull] CSharpUtilities cSharpUtilities) { Check.NotNull(scaffoldingUtilities, nameof(scaffoldingUtilities)); Check.NotNull(cSharpUtilities, nameof(cSharpUtilities)); ScaffoldingUtilities = scaffoldingUtilities; }
public void Generate_MethodCallCodeFragment_works_when_nested_closure() { var method = new MethodCallCodeFragment( "Test", new NestedClosureCodeFragment("x", new MethodCallCodeFragment("Test"))); var result = new CSharpUtilities().Generate(method); Assert.Equal(".Test(x => x.Test())", result); }
public EntityTypeWriter( [NotNull] ScaffoldingUtilities scaffoldingUtilities, [NotNull] CSharpUtilities cSharpUtilities) { Check.NotNull(scaffoldingUtilities, nameof(scaffoldingUtilities)); Check.NotNull(cSharpUtilities, nameof(cSharpUtilities)); ScaffoldingUtilities = scaffoldingUtilities; CSharpUtilities = cSharpUtilities; }
private static IScaffoldingCodeGenerator CreateGenerator() { var cSharpUtilities = new CSharpUtilities(); return(new CSharpScaffoldingGenerator( new CSharpDbContextGenerator( new TestProviderScaffoldingCodeGenerator(), new AnnotationCodeGenerator(new AnnotationCodeGeneratorDependencies()), cSharpUtilities), new CSharpEntityTypeGenerator(cSharpUtilities))); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public ConfigurationFactory([NotNull] IRelationalAnnotationProvider extensionsProvider, [NotNull] CSharpUtilities cSharpUtilities, [NotNull] ScaffoldingUtilities scaffoldingUtilities) { Check.NotNull(extensionsProvider, nameof(extensionsProvider)); Check.NotNull(cSharpUtilities, nameof(cSharpUtilities)); Check.NotNull(scaffoldingUtilities, nameof(scaffoldingUtilities)); ExtensionsProvider = extensionsProvider; CSharpUtilities = cSharpUtilities; ScaffoldingUtilities = scaffoldingUtilities; }
private static IScaffoldingCodeGenerator CreateGenerator() { var cSharpUtilities = new CSharpUtilities(); return(new CSharpScaffoldingGenerator( new CSharpDbContextGenerator( #pragma warning disable CS0618 // Type or member is obsolete Enumerable.Empty <IScaffoldingProviderCodeGenerator>(), #pragma warning restore CS0618 // Type or member is obsolete new[] { new TestProviderCodeGenerator() }, new AnnotationCodeGenerator(new AnnotationCodeGeneratorDependencies()), cSharpUtilities), new CSharpEntityTypeGenerator(cSharpUtilities))); }
private static IReverseEngineerScaffolder CreateScaffolder() { var cSharpUtilities = new CSharpUtilities(); return(new ReverseEngineerScaffolder( new FakeDatabaseModelFactory(), new FakeScaffoldingModelFactory(new TestOperationReporter()), new ScaffoldingCodeGeneratorSelector( new[] { new CSharpScaffoldingGenerator( new CSharpDbContextGenerator( new TestProviderScaffoldingCodeGenerator(), new AnnotationCodeGenerator(new AnnotationCodeGeneratorDependencies()), cSharpUtilities), new CSharpEntityTypeGenerator(cSharpUtilities)) }), cSharpUtilities)); }
private static IReverseEngineerScaffolder CreateScaffolder() { var cSharpUtilities = new CSharpUtilities(); return(new ReverseEngineerScaffolder( new FakeDatabaseModelFactory(), new FakeScaffoldingModelFactory(new TestOperationReporter()), new ScaffoldingCodeGeneratorSelector( new[] { new CSharpScaffoldingGenerator( new CSharpDbContextGenerator( #pragma warning disable CS0618 // Type or member is obsolete Enumerable.Empty <IScaffoldingProviderCodeGenerator>(), #pragma warning restore CS0618 // Type or member is obsolete new[] { new TestProviderCodeGenerator() }, new AnnotationCodeGenerator(new AnnotationCodeGeneratorDependencies()), cSharpUtilities), new CSharpEntityTypeGenerator(cSharpUtilities)) }), cSharpUtilities)); }
private void ValidateContextNameInReverseEngineerGenerator(string contextName) { var cSharpUtilities = new CSharpUtilities(); var reverseEngineer = new ReverseEngineerScaffolder( new FakeDatabaseModelFactory(), new FakeScaffoldingModelFactory(new TestOperationReporter()), new ScaffoldingCodeGeneratorSelector( new[] { new CSharpScaffoldingGenerator( new CSharpDbContextGenerator( #pragma warning disable CS0618 // Type or member is obsolete Enumerable.Empty <IScaffoldingProviderCodeGenerator>(), #pragma warning restore CS0618 // Type or member is obsolete new[] { new TestProviderCodeGenerator() }, new FakeAnnotationCodeGenerator(), cSharpUtilities), new CSharpEntityTypeGenerator(cSharpUtilities)) }), cSharpUtilities); Assert.Equal( DesignStrings.ContextClassNotValidCSharpIdentifier(contextName), Assert.Throws <ArgumentException>( () => reverseEngineer.Generate( connectionString: "connectionstring", tables: Enumerable.Empty <string>(), schemas: Enumerable.Empty <string>(), projectPath: "FakeProjectPath", outputPath: null, rootNamespace: "FakeNamespace", language: "", contextName: contextName, useDataAnnotations: false, useDatabaseNames: false)) .Message); }