Ejemplo n.º 1
0
        public void AddEntity(IEntityAdditionOptions options)
        {
            if (!EntityAdditionOptions.Validate(options))
            {
                throw new OptionValidationException("Die Optionen sind nicht korrekt formatiert.");
            }

            foreach (ClassGeneration classGeneration in classGenerations)
            {
                classGeneration.PerformAddEntityCommand(options);
            }
        }
Ejemplo n.º 2
0
        public static void Perform(string[] args)
        {
            if (args.Length < 3)
            {
                Console.WriteLine("Bitte geben sie alle Informationen an. Beispiel: contractor add entity Bankwesen.Bank:Banken [-s|--scope MandantenTrennung.Mandant:Mandanten]");
                return;
            }

            var options = ContractorOptionsLoader.Load(Directory.GetCurrentDirectory());
            EntityAdditionOptions entityOptions = new EntityAdditionOptions(options);

            ParseOptions(entityOptions, args);

            try
            {
                ContractorCoreApi contractorCoreApi = new ContractorCoreApi();
                contractorCoreApi.AddEntity(entityOptions);
                Console.WriteLine($"Entity '{entityOptions.EntityName} ({entityOptions.EntityNamePlural})' zur Domain '{entityOptions.Domain}' hinzugefügt'");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 3
0
        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);
        }