public static IContractorOptions Load(string folder) { string optionsPath = Path.Combine(folder, "contractor.json"); string optionsJson = File.ReadAllText(optionsPath); ContractorOptions options = JsonConvert.DeserializeObject <ContractorOptions>(optionsJson); options.BackendDestinationFolder = Path.Combine(folder, options.BackendDestinationFolder); options.DbDestinationFolder = Path.Combine(folder, options.DbDestinationFolder); options.FrontendDestinationFolder = Path.Combine(folder, options.FrontendDestinationFolder); return(options); }
private static void AddRelation(ContractorOptions contractorOptions) { ContractorCoreApi contractorCoreApi = new ContractorCoreApi(); RelationAdditionOptions relationOptions = new RelationAdditionOptions(contractorOptions) { DomainFrom = "GegönntesBankwesen", EntityNameFrom = "GegönnteBank", EntityNamePluralFrom = "GegönnteBanken", PropertyNameFrom = "BesteBank", DomainTo = "GegönnterKundenstamm", EntityNameTo = "GegönnterKunde", EntityNamePluralTo = "GegönnteKunden", PropertyNameTo = "BesteKunden", }; contractorCoreApi.Add1ToNRelation(relationOptions); }
private static void TestApiProjectGeneration( string backendDestinationFolder, string dbDestinationFolder, string frontendDestinationFolder) { var contractorOptions = new ContractorOptions() { BackendDestinationFolder = backendDestinationFolder, DbDestinationFolder = dbDestinationFolder, FrontendDestinationFolder = frontendDestinationFolder, ProjectName = "Contract.Architecture.Backend.Core", DbProjectName = "Contract.Architecture.Database.Core", }; AddBanken(contractorOptions); AddKunden(contractorOptions); AddRelation(contractorOptions); }
private static void AddBanken(ContractorOptions contractorOptions) { ContractorCoreApi contractorCoreApi = new ContractorCoreApi(); // Domain var domainAdditionOptions = new DomainAdditionOptions(contractorOptions) { Domain = "GegönntesBankwesen" }; contractorCoreApi.AddDomain(domainAdditionOptions); // Entities EntityAdditionOptions entityAdditionOptions = new EntityAdditionOptions(domainAdditionOptions) { EntityName = "GegönnteBank", EntityNamePlural = "GegönnteBanken" }; contractorCoreApi.AddEntity(entityAdditionOptions); // Properties PropertyAdditionOptions propertyAdditionOptions = new PropertyAdditionOptions(entityAdditionOptions) { PropertyType = PropertyTypes.String, PropertyName = "Name", PropertyTypeExtra = "256" }; contractorCoreApi.AddProperty(propertyAdditionOptions); propertyAdditionOptions = new PropertyAdditionOptions(entityAdditionOptions) { PropertyType = PropertyTypes.String, PropertyName = "GegönnterName", PropertyTypeExtra = "256" }; contractorCoreApi.AddProperty(propertyAdditionOptions); propertyAdditionOptions = new PropertyAdditionOptions(entityAdditionOptions) { PropertyType = PropertyTypes.Boolean, PropertyName = "GegönnterBoolean" }; contractorCoreApi.AddProperty(propertyAdditionOptions); propertyAdditionOptions = new PropertyAdditionOptions(entityAdditionOptions) { PropertyType = PropertyTypes.DateTime, PropertyName = "GegönntesDateTime", }; contractorCoreApi.AddProperty(propertyAdditionOptions); propertyAdditionOptions = new PropertyAdditionOptions(entityAdditionOptions) { PropertyType = PropertyTypes.Double, PropertyName = "GegönnterDouble" }; contractorCoreApi.AddProperty(propertyAdditionOptions); propertyAdditionOptions = new PropertyAdditionOptions(entityAdditionOptions) { PropertyType = PropertyTypes.Guid, PropertyName = "GegönnteGuid", }; contractorCoreApi.AddProperty(propertyAdditionOptions); propertyAdditionOptions = new PropertyAdditionOptions(entityAdditionOptions) { PropertyType = PropertyTypes.Integer, PropertyName = "GegönnterInteger" }; contractorCoreApi.AddProperty(propertyAdditionOptions); }