public static async Task <ReverseEngineerResult> LaunchExternalRunnerAsync(ReverseEngineerOptions options, CodeGenerationMode codeGenerationMode, Project project) { var databaseObjects = options.Tables; if (!databaseObjects.Any(t => t.ObjectType == ObjectType.Table)) { // No tables selected, so add a dummy table in order to generate an empty DbContext databaseObjects.Add(new SerializationTableModel($"Dummy_{new Guid(GuidList.guidDbContextPackagePkgString)}", ObjectType.Table, null)); } var commandOptions = new ReverseEngineerCommandOptions { ConnectionString = options.ConnectionString, ContextClassName = options.ContextClassName, CustomReplacers = options.CustomReplacers, Dacpac = options.Dacpac, DatabaseType = options.DatabaseType, DefaultDacpacSchema = options.DefaultDacpacSchema, IncludeConnectionString = options.IncludeConnectionString, OutputPath = options.OutputPath, ContextNamespace = options.ContextNamespace, ModelNamespace = options.ModelNamespace, OutputContextPath = options.OutputContextPath, UseSchemaFolders = options.UseSchemaFolders, ProjectPath = options.ProjectPath, ProjectRootNamespace = options.ProjectRootNamespace, SelectedHandlebarsLanguage = options.SelectedHandlebarsLanguage, SelectedToBeGenerated = options.SelectedToBeGenerated, Tables = databaseObjects, UseDatabaseNames = options.UseDatabaseNames, UseFluentApiOnly = options.UseFluentApiOnly, UseHandleBars = options.UseHandleBars, UseInflector = options.UseInflector, UseLegacyPluralizer = options.UseLegacyPluralizer, UseSpatial = options.UseSpatial, UseHierarchyId = options.UseHierarchyId, UseDbContextSplitting = options.UseDbContextSplitting, UseNodaTime = options.UseNodaTime, UseBoolPropertiesWithoutDefaultSql = options.UseBoolPropertiesWithoutDefaultSql, UseNullableReferences = options.UseNullableReferences, UseNoConstructor = options.UseNoConstructor, UseNoNavigations = options.UseNoNavigations, UseNoObjectFilter = options.UseNoObjectFilter, UseNoDefaultConstructor = options.UseNoDefaultConstructor, UseManyToManyEntity = options.UseManyToManyEntity, RunCleanup = AdvancedOptions.Instance.RunCleanup, UseMultipleSprocResultSets = AdvancedOptions.Instance.DiscoverMultipleResultSets, OptionsPath = options.OptionsPath, LegacyLangVersion = await project.IsLegacyAsync(), MergeDacpacs = AdvancedOptions.Instance.MergeDacpacs, UseLegacyResultSetDiscovery = AdvancedOptions.Instance.UseLegacyResultSetDiscovery, UseAsyncCalls = AdvancedOptions.Instance.PreferAsyncCalls, }; var launcher = new EfRevEngLauncher(commandOptions, codeGenerationMode); return(await launcher.GetOutputAsync()); }
public static async Task <ReverseEngineerResult> LaunchExternalRunnerAsync(ReverseEngineerOptions options, CodeGenerationMode codeGenerationMode) { var databaseObjects = options.Tables; if (databaseObjects.Where(t => t.ObjectType == ObjectType.Table).Count() == 0) { // No tables selected, so add a dummy table in order to generate an empty DbContext databaseObjects.Add(new SerializationTableModel($"Dummy_{new Guid(GuidList.guidDbContextPackagePkgString)}", ObjectType.Table, null)); } var commandOptions = new ReverseEngineerCommandOptions { ConnectionString = options.ConnectionString, ContextClassName = options.ContextClassName, CustomReplacers = options.CustomReplacers, Dacpac = options.Dacpac, DatabaseType = options.DatabaseType, DefaultDacpacSchema = options.DefaultDacpacSchema, IncludeConnectionString = options.IncludeConnectionString, OutputPath = options.OutputPath, ContextNamespace = options.ContextNamespace, ModelNamespace = options.ModelNamespace, OutputContextPath = options.OutputContextPath, UseSchemaFolders = options.UseSchemaFolders, ProjectPath = options.ProjectPath, ProjectRootNamespace = options.ProjectRootNamespace, SelectedHandlebarsLanguage = options.SelectedHandlebarsLanguage, SelectedToBeGenerated = options.SelectedToBeGenerated, Tables = databaseObjects, UseDatabaseNames = options.UseDatabaseNames, UseFluentApiOnly = options.UseFluentApiOnly, UseHandleBars = options.UseHandleBars, UseInflector = options.UseInflector, UseLegacyPluralizer = options.UseLegacyPluralizer, UseSpatial = options.UseSpatial, UseDbContextSplitting = options.UseDbContextSplitting, UseNodaTime = options.UseNodaTime, UseBoolPropertiesWithoutDefaultSql = options.UseBoolPropertiesWithoutDefaultSql, UseNullableReferences = options.UseNullableReferences, UseNoConstructor = options.UseNoConstructor, UseNoNavigations = options.UseNoNavigations, UseNoObjectFilter = options.UseNoObjectFilter, UseNoDefaultConstructor = options.UseNoDefaultConstructor, }; var launcher = new EfRevEngLauncher(commandOptions, codeGenerationMode); return(await launcher.GetOutputAsync()); }
public static async Task <ReverseEngineerResult> LaunchExternalRunnerAsync(ReverseEngineerOptions options, CodeGenerationMode codeGenerationMode) { var commandOptions = new ReverseEngineerCommandOptions { ConnectionString = options.ConnectionString, ContextClassName = options.ContextClassName, CustomReplacers = options.CustomReplacers, Dacpac = options.Dacpac, DatabaseType = options.DatabaseType, DefaultDacpacSchema = options.DefaultDacpacSchema, IncludeConnectionString = options.IncludeConnectionString, OutputPath = options.OutputPath, ContextNamespace = options.ContextNamespace, ModelNamespace = options.ModelNamespace, OutputContextPath = options.OutputContextPath, UseSchemaFolders = options.UseSchemaFolders, ProjectPath = options.ProjectPath, ProjectRootNamespace = options.ProjectRootNamespace, SelectedHandlebarsLanguage = options.SelectedHandlebarsLanguage, SelectedToBeGenerated = options.SelectedToBeGenerated, Tables = options.Tables, UseDatabaseNames = options.UseDatabaseNames, UseFluentApiOnly = options.UseFluentApiOnly, UseHandleBars = options.UseHandleBars, UseInflector = options.UseInflector, UseLegacyPluralizer = options.UseLegacyPluralizer, UseSpatial = options.UseSpatial, UseDbContextSplitting = options.UseDbContextSplitting, UseNodaTime = options.UseNodaTime, UseBoolPropertiesWithoutDefaultSql = options.UseBoolPropertiesWithoutDefaultSql, UseNullableReferences = options.UseNullableReferences, UseNoConstructor = options.UseNoConstructor, UseNoNavigations = options.UseNoNavigations, UseNoObjectFilter = options.UseNoObjectFilter, }; var launcher = new EfRevEngLauncher(commandOptions, codeGenerationMode); return(await launcher.GetOutputAsync()); }