public ApplicationController(ApplicationSettings applicationSettings, AbstractMetadataReader metadataReader) { _applicationSettings = applicationSettings; _castleEntityGenerator = new KPCastleEntityGenerator(applicationSettings, metadataReader); _castleEntityBoGenerator = new KPCastleEntityBOGenerator(applicationSettings, metadataReader); _kpAspNetFormsViewGerenator = new KPAspNetFormsViewGerenator(applicationSettings, metadataReader); _kpAspNetFormsViewCSGerenator = new KPAspNetFormsViewCSGerenator(applicationSettings, metadataReader); _kpAspNetFormsViewDesignerGerenator = new KPAspNetFormsViewDesignerGerenator(applicationSettings, metadataReader); _kpAspNetFormsGerenator = new KPAspNetFormsGerenator(applicationSettings, metadataReader); _kpAspNetFormsCSGerenator = new KPAspNetFormsCSGerenator(applicationSettings, metadataReader); _kpAspNetFormsDesignerGerenator = new KPAspNetFormsDesignerGerenator(applicationSettings, metadataReader); }
public static ApplicationSettings Load() { ApplicationSettings appSettings = null; var xmlSerializer = new XmlSerializer(typeof(ApplicationSettings)); string folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); var fi = new FileInfo(Path.Combine(folder, @"KPCodeGen.config")); if (fi.Exists) { try { using (FileStream fileStream = fi.OpenRead()) { appSettings = (ApplicationSettings)xmlSerializer.Deserialize(fileStream); } } catch (Exception) { appSettings = new ApplicationSettings(); } } else appSettings = new ApplicationSettings(); return appSettings; }
private void Generate(Table table, ApplicationSettings appSettings) { UpdateApplicationSettings(table, appSettings); foreach (Column column in table.Columns) { if (column.EntityComponentForm == null) column.EntityComponentForm = KPComponentsFormsBO.GetEntityControlForm(column); if (column.EntityComponentView == null) column.EntityComponentView = KPComponentsViewBO.GetEntityControlView(column); } new ApplicationController(appSettings, MetadataReader).GenerateFiles(table); }
private void CaptureApplicationSettings() { if (ApplicationSettings == null) { ApplicationSettings = new ApplicationSettings(); } ApplicationSettings.NamespaceEntity = txtNamespaceEntity.Text; ApplicationSettings.NamespaceEntityBO = txtNamespaceEntityBO.Text; ApplicationSettings.NamespaceWebProject = txtNamespaceWebProject.Text; ApplicationSettings.Language = Language.CSharp; ApplicationSettings.ValidationStyle = ValidationStyle.NhibernateValidator; ApplicationSettings.DirFileEntity = txtDirFileEntity.Text; ApplicationSettings.DirFileEntityBO = txtDirFileEntityBO.Text; ApplicationSettings.DirFileForms = txtDirFileForms.Text; ApplicationSettings.FieldNamingConvention = FieldNamingConvention.PascalCase; ApplicationSettings.LastUsedConnection = CurrentConnection == null ? (Guid?)null : CurrentConnection.Id; if (CurrentConnection != null) { if (!ApplicationSettings.Connections.Exists(x => x.ConnectionString == CurrentConnection.ConnectionString)) { ApplicationSettings.Connections.Add(CurrentConnection); } } }
private void UpdateApplicationSettings(Table tableName, ApplicationSettings appSettings) { string sequence = string.Empty; object sequenceName = null; if (cmbSequencesOracle.InvokeRequired) { cmbSequencesOracle.Invoke(new MethodInvoker(delegate { sequenceName = cmbSequencesOracle.SelectedItem; })); } else { sequenceName = cmbSequencesOracle.SelectedItem; } if (sequenceName != null) { sequence = sequenceName.ToString(); } string dirFileEntity = txtDirFileEntity.Text; if (!String.IsNullOrEmpty(dirFileEntity) && !Directory.Exists(dirFileEntity)) { Directory.CreateDirectory(dirFileEntity); } string dirFileEntityBO = txtDirFileEntityBO.Text; if (!String.IsNullOrEmpty(dirFileEntityBO) && !Directory.Exists(dirFileEntityBO)) { Directory.CreateDirectory(dirFileEntityBO); } string dirFileForms = txtDirFileForms.Text; if (!String.IsNullOrEmpty(dirFileForms) && !Directory.Exists(dirFileForms)) { Directory.CreateDirectory(dirFileForms); } if (appSettings == null) appSettings = new ApplicationSettings(); appSettings.DatabaseServerType = CurrentConnection.Type; appSettings.DirFileEntity = dirFileEntity; appSettings.DirFileEntityBO = dirFileEntityBO; appSettings.DirFileForms = dirFileForms; appSettings.OwnerSchema = cmbSchemaOwners.SelectedItem != null ? cmbSchemaOwners.SelectedItem.ToString() : String.Empty; appSettings.TableName = tableName.Name; appSettings.NamespaceEntityBO = txtNamespaceEntityBO.Text; appSettings.NamespaceEntity = txtNamespaceEntity.Text; appSettings.NamespaceWebProject = txtNamespaceWebProject.Text; appSettings.Sequence = sequence; appSettings.Language = Language.CSharp; appSettings.FieldNamingConvention = FieldNamingConvention.PascalCase; appSettings.FieldGenerationConvention = FieldGenerationConvention.Property; appSettings.ConnectionString = CurrentConnection.ConnectionString; appSettings.ClassNamePrefix = appSettings.ClassNamePrefix; appSettings.ValidationStyle = appSettings.ValidationStyle; appSettings.EntityName = txtEntityName.Text; }
private void ApplicationSettings_EventSettingsChanged(ApplicationSettings sender, SettingsEventArgs e) { }