public virtual IEnumerable<string> ReverseEngineer( [NotNull] string providerAssemblyName, [NotNull] string connectionString, [NotNull] string rootNamespace, [NotNull] string projectDir) { Check.NotNull(providerAssemblyName, nameof(providerAssemblyName)); Check.NotEmpty(connectionString, nameof(connectionString)); Check.NotEmpty(rootNamespace, nameof(rootNamespace)); Check.NotEmpty(projectDir, nameof(projectDir)); var assembly = Assembly.Load(new AssemblyName(providerAssemblyName)); if (assembly == null) { throw new InvalidOperationException(Strings.CannotFindAssembly(providerAssemblyName)); } var configuration = new ReverseEngineeringConfiguration() { ProviderAssembly = assembly, ConnectionString = connectionString, Namespace = rootNamespace, OutputPath = projectDir }; var generator = new ReverseEngineeringGenerator(_serviceProvider); return generator.GenerateAsync(configuration).Result; }
public EntityTypeCodeGenerator( [NotNull] ReverseEngineeringGenerator generator, [NotNull] IEntityType entityType, [NotNull] string namespaceName) { Check.NotNull(generator, nameof(generator)); Check.NotNull(entityType, nameof(entityType)); Check.NotEmpty(namespaceName, nameof(namespaceName)); Generator = generator; EntityType = entityType; ClassNamespace = namespaceName; }
public DbContextCodeGenerator( [NotNull] ReverseEngineeringGenerator generator, [NotNull] IModel model, [NotNull] string namespaceName, [CanBeNull] string className, [NotNull] string connectionString) { Check.NotNull(generator, nameof(generator)); Check.NotNull(model, nameof(model)); Check.NotEmpty(namespaceName, nameof(namespaceName)); Check.NotEmpty(connectionString, nameof(connectionString)); Generator = generator; Model = model; ClassNamespace = namespaceName; ClassName = className; ConnectionString = connectionString; }
public void Constructs_correct_namespace( string rootNamespace, string projectPath, string outputPath, string resultingNamespace) { Assert.Equal(resultingNamespace, ReverseEngineeringGenerator.ConstructNamespace(rootNamespace, projectPath, outputPath)); }