Ejemplo n.º 1
0
        private DbProjectGeneratorProperties CreateGeneratorProperties()
        {
            if (this.WriteProjectSettingsDemanded != null)
                WriteProjectSettingsDemanded(this, new EventArgs());

            DbProjectGeneratorProperties properties = new DbProjectGeneratorProperties();

            // Generator properties are set/pulled on demand, ie. when generator user control requests it.
            properties.MetaDataSource = this.uiMetaSource.MetaDataSource;
            properties.SelectedItems = this.uiTableList.SelectedTableAndViewNames;
            properties.SelectedViews = this.uiTableList.GetSelectedViewNames();
            properties.ExcludedColumnsRegex = this.uiTableList.ExcludedColumnsRegex;
            properties.SelectedProcedures = this.uiSpList.SelectedProcedures;
            properties.ItemTemplates = this.uiCodeOptions.TableItemTemplates;
            properties.SpAndCatalogTemplate = this.uiCodeOptions.SpAndCatalogTemplate;
            properties.AppConfigTemplate = this.uiCodeOptions.AppConfigTemplate;
            properties.OutputFolder = this.uiGenerator.OutputDirectory;
            var defaultTypeMapper = DbGeneratorComponentFactory.GetTypeMappers(properties.MetaDataSource.DBMS).ElementAt(0);
            properties.TypeTemplate = defaultTypeMapper;

            return properties;
        }
Ejemplo n.º 2
0
 public DbProjectGenerator(DbProjectGeneratorProperties properties)
 {
     this.metadataSource = properties.MetaDataSource;
     this.outputFolder = TextUtil.EnsureSuffix(properties.OutputFolder, @"\");
     this.selectedTables = properties.SelectedItems;
     this.excludedColumnsCriteria = properties.ExcludedColumnsRegex;
     this.selectedProcedures = properties.SelectedProcedures ?? new string[0];
     this.typeTemplate = properties.TypeTemplate;
     this.spAndCatalogTemplate = properties.SpAndCatalogTemplate;
     this.appConfigTemplate = properties.AppConfigTemplate;
     this.tableItemTemplates = properties.ItemTemplates;
     this.selectedViews = new SortedList<string, string>(properties.SelectedViews.Length);
     foreach (string view in properties.SelectedViews)
         this.selectedViews.Add(view, view);
 }