I am learning and I am trying to change the parameter name of my autogenerated partial class using [Display()] attribute but I am getting this error message.
Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'Student_Age' could not be found (are you missing a using directive or an assembly reference?) EFScuffolding C:\Users\kusha\source\repos\EFModel\EFScuffolding\Models\Students.cs 20 Active
This is my autogenerated code for Student Class
namespace EFDemo.Models
{
using System;
using System.Collections.Generic;
public partial class Student
{
public int StudentID { get; set; }
public string Student_Name { get; set; }
public string Student_Major { get; set; }
public Nullable<int> Student_Age { get; set; }
}
}
This the class I am using to modify the parameters for display
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using EFScuffolding.Models;
namespace EFDemo.Models
{
[MetadataType(typeof(StudentMetaData))]
public partial class Student
{
}
public class StudentMetaData
{
[Required]
public int StudentID { get; set; }
[Required]
[Display(Student_Age = "Student Name")]
public string Student_Name { get; set; }
[Required]`enter code here`
[Display(Student_Major = "Student Major")]
public string Student_Major { get; set; }
[Required]
[Display(Student_Age = "Student Age")]
public Nullable<int> Student_Age { get; set; }
}
}
I am using MVC 5 ,EF6 and Visual Studio 17. Am I missing anything in the code.