Why default asp Scaffolding skips some of the model properties while generating 'Create' and 'Edit' views?

75 views Asked by At

I am trying to generate a scaffold controller in my project, which is in VS2015 community edition and based on entity framework 6.1.3. Every time I try to do so, it only generates portion of the model. I mean the properties below.

public string Number { get; set; }
    public string Firstname { get; set; }
    public string Surname { get; set; }

model class

public class Students
{
    [Key]
    [ScaffoldColumn(false)]
    public int StudentsID { get; set; }

    [DataType(DataType.Text)]
    [Display(Name = "Student ID")]
    public string Number { get; set; }

    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Firstname")]
    public string Firstname { get; set; }

    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Surname")]
    public string Surname { get; set; }

    [DataType(DataType.Text)]
    [Display(Name = "Date Of Birth")]
    public string DateOfBirth { get; internal set; }
    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Year")]
    public int Year { get; internal set; }
    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Class")]
    public int Class { get; internal set; }
    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Address")]
    public string Address { get; internal set; }
    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Postal code")]
    public string Postalcode { get; internal set; }
    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Doctor Name")]
    public string DoctorName { get; internal set; }
    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Doctor Address")]
    public string DoctorAddress { get; internal set; }
    //[Required]
    [DataType(DataType.Text)]
    [Display(Name = "Doctor Postalcode")]
    public string DoctorPostalcode { get; internal set; }
    [DataType(DataType.Text)]
    [Display(Name = "Meds Info")]
    public string MedsInfo { get; internal set; }



}

Data context

public class SchoolContext : DbContext
{
    public SchoolContext()
        : base("DefaultConnection")
    {
    }
    public DbSet<Students> students { get; set; }


}

I don't know what to do. Same problem occurs, no matter if it is in a new project. My scaffolding controller creation process is below:

enter image description here

enter image description here

enter image description here

0

There are 0 answers