I need a view model in my ASP.NET MVC 5 project, but when I added it to the models folder, a new entity was added to the database, and I had to add the migration and update my database. I do not want this to happen, as it is a view model that I am adding, not a model that I need to store in the database. I want to raise some of the controllers and views, so I added the primary key to the class. I did not add the newly created view model to the class DbContext.
ViewModel:
public class RolesViewModel
{
public int RolesViewModelId { get; set; }
public string Role { get; set; }
}
Is there a way to create a view model that is not automatically added to the class DbContextand therefore leads to a change in the data model?
Many thanks,
Jason