Create a web form generator

2

I need to create a web form generator, ie create form, fields, validations, CSS so that this structure goes to a data repository and when querying the mount structure on the form screen.

Does anyone know what technology is best to create a project like this?

    
asked by anonymous 16.09.2014 / 20:42

1 answer

2

Yes. It's called Scaffolding .

Visual Studio has Scaffolding shipped from the 2013 version, and by command line up to the 2012 version (maintained by Microsoft) and 2013 and 2015 (maintained by the community). This command-line support can be installed through the following NuGet package:

  

link (for Visual Studio 2012)    link (for Visual Studio 2013 and 2015)    link (Visual Studio 2015 only if the most recent version gives some error)

By command line, I teach to use the commands in these answers:

Using the Visual Studio embedded feature

I'm assuming you're using Entity Framework and MVC5 in your project.

First you need to create a Model . I'll put an example:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace MeuProjeto.Models
{
    public class Color
    {
        [Key]
        public int ColorId { get; set; }

        [Required]
        public String Name { get; set; }
        [Required]
        public String Code { get; set; }

        public virtual ICollection<Product> Products { get; set; }
    }
}

Then right-click the Controllers directory of your solution > Add > Controller ...

ChoosetheMVC5ControllerwithViews,usingEntityFrameworkoption:

Fill in the Model and context class. If a context class still does not exist, create one using the + button. Click Add :

Onceyouhavedonethis,aControllerwillbecreatedwiththebasicoperations(List,Detail,Insert,EditandDelete),moreorlessasshownintheimagebelow:

    
16.09.2014 / 20:44