I'm working with a MVC 5 project with Entity Framework , where through Code First I created a template class that has a field which does not exist in the database, in the case of the ConfirmPassword field.
This field should appear in a View generated by Scaffolding , however, I noticed that properties with the NotMapped notation Scaffolding to create the Views.
This notation becomes necessary since the field does not represent a field of my entity in the database.
Below is the simplified code for my model class:
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Project.Model
{
[Table("Users")]
public class User : Base
{
public string Name { get; set; }
public string Login { get; set; }
public string Password { get; set; }
[NotMapped]
public string ConfirmPassword { get; set; }
public string Email { get; set; }
}
}
Scaffolding is generated by adding a new "Controller MVC 5 with views, using Entity Framework" in the project. >
The question is, would it be possible to