Ejemplo n.º 1
0
        public async Task GenerateCode([NotNull] CommandLineGeneratorModel model)
        {
            ControllerGeneratorBase generator = null;

            if (string.IsNullOrEmpty(model.ModelClass))
            {
                if (model.GenerateReadWriteActions)
                {
                    //Controller with Actions
                }
                else
                {
                    generator = GetGenerator <MvcControllerEmpty>(); //This need to handle the WebAPI Empty as well...
                }
            }
            else
            {
                generator = GetGenerator <ControllerWithContextGenerator>();
            }

            if (generator != null)
            {
                await generator.Generate(model);
            }
            else
            {
                // Just throwing as I enable this functionality, should remove it once I fill all the above...
                throw new Exception("Functionality not yet enabled...");
            }
        }
Ejemplo n.º 2
0
        public async Task GenerateCode(CommandLineGeneratorModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            ControllerGeneratorBase generator = null;

            if (string.IsNullOrEmpty(model.ModelClass))
            {
                if (model.GenerateReadWriteActions)
                {
                    generator = GetGenerator <MvcControllerWithReadWriteActionGenerator>();
                }
                else
                {
                    generator = GetGenerator <MvcControllerEmpty>(); //This need to handle the WebAPI Empty as well...
                }
            }
            else
            {
                generator = GetGenerator <ControllerWithContextGenerator>();
            }

            if (generator != null)
            {
                await generator.Generate(model);
            }
        }