/// <summary> /// Return driver types. /// </summary> /// <returns> /// The <see cref="object[]" />. /// </returns> public object[] ReturnLanguageOutputs() { List <ComboboxItem> items = new List <ComboboxItem>(); items.Add(new ComboboxItem { Text = "Please select" }); if (this.Data != null) { IDataType dataType = ScaffoldConfig.ReturnDataType(this.Data.DataType); foreach (LanguageOutputDetails selectedLanguageDetails in dataType.LanguageOutputDetails) { foreach (var language in ScaffoldConfig.LanguageOutputs) { if (selectedLanguageDetails.LanguageOutput == new Guid(language.Metadata["ValueMetaData"].ToString())) { items.Add( new ComboboxItem { Text = (string)language.Metadata["NameMetaData"], Value = new Guid(language.Metadata["ValueMetaData"].ToString()) }); break; } } } } return(items.ToArray()); }
/// <summary> /// Returns the data types as Templates /// </summary> /// <returns> /// The <see cref="List" />. /// </returns> /// <summary> /// Validate class. /// </summary> /// <returns> /// The <see cref="List{T}" /> /// Errors returned /// </returns> public List <Validation> Validate() { Logger.Trace($"Started Validate()"); this.ValidationResult = this.ProjectDefinition.Validate(); List <Validation> validations; foreach (DomainDefinition definition in this.ProjectDefinition.Domains) { foreach (Template template in definition.Package.Templates) { var parameters = new Dictionary <string, string> { { "basePath", this.ProjectDefinition.OutputPath } }; IDataType dataType = ScaffoldConfig.ReturnDataType(template.DataType); dataType.DomainDefinition = this.ProjectDefinition.Domains[0]; dataType.Load(parameters); validations = dataType.Validate(); foreach (Validation validation in validations) { this.ValidationResult.Add(validation); } } } Logger.Trace($"Completed Validate()"); return(this.ValidationResult); }
/// <summary> /// The validate. /// </summary> /// <returns> /// The <see cref="List" />. /// </returns> public override List <Validation> Validate() { this.ValidationResult = new List <Validation>(); this.MissingApplicationList.Clear(); if (this.ApplicationServiceDataType == null) { this.ApplicationServiceDataType = ScaffoldConfig.ReturnDataType(new Guid("1BC1B0C4-1E41-9146-82CF-599181CE4420")) as ApplicationServiceDataType; } foreach (var webApiServiceData in this.WebApiDataList) { foreach (ApplicationServiceData serviceData in webApiServiceData.Models) { if (!this.ApplicationServiceDataType.ApplicationServiceData.Exists(t => t.Id == serviceData.Id)) { this.ValidationResult.Add( new Validation( ValidationType.ApplicationServicesMissing, $"The {webApiServiceData.WebApiName} WebApi is missing {serviceData.ApplicationServiceName} Application Service")); this.MissingApplicationList.Add( new ApplicationServiceDataError { ApplicationServiceName = serviceData.ApplicationServiceName, ApplicationServiceData = serviceData }); } if (string.IsNullOrEmpty(webApiServiceData.WebApiName)) { this.ValidationResult.Add( new Validation(ValidationType.ContextNameEmpty, "WebApiDataList must have a name")); } } } if (this.LanguageOutputDetails.Count == 0) { this.ValidationResult.Add( new Validation( ValidationType.DataTypeLanguageMissing, "A Datatype must have at least one LanguageOption")); } return(this.ValidationResult); }
/// <summary> /// The combo box language output_ selected index changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void ComboBoxLanguageOutput_SelectedIndexChanged(object sender, EventArgs e) { ComboboxItem selectedItem = (sender as ComboBox).SelectedItem as ComboboxItem; if (selectedItem != null && this.DataSourceInitialized) { if (selectedItem.Value != null) { this.LanguageId = new Guid(selectedItem.Value.ToString()); IDataType dataType = ScaffoldConfig.ReturnDataType(this.Data.DataType); LanguageOutputDetails languageOutputDetail = dataType.LanguageOutputDetails.FirstOrDefault(l => l.LanguageOutput == this.LanguageId); this.GeneratorTypeId = languageOutputDetail.OutputGenerator; this.ComboBoxGeneratorOutput.SelectedValue = this.GeneratorTypeId; this.ListBoxTemplates.Items.Clear(); foreach (string template in languageOutputDetail.Templates) { this.ListBoxTemplates.Items.Add(template); } if (languageOutputDetail?.Templates != null && languageOutputDetail.Templates.Any()) { this.TemplatePath = languageOutputDetail.Templates[0]; } } else { this.LanguageId = Guid.Empty; this.GeneratorTypeId = Guid.Empty; this.ComboBoxGeneratorOutput.SelectedIndex = 0; this.ListBoxTemplates.Items.Clear(); } this.UpdateRelatedPackages(); } }