ASP.NET MVC > Models

Mapping model to existing table in database in ASP.NET MVC

How to give a different name to the model and still map with the database table?


To give different name to the Model and still map it with the database table name, we can use Table attribute in the Model class. 

[Table("Files")]
public class FilesModel 


}

Here, despite our Model name is FilesModel, however this Model is mapping with “Files” table of the database. 

 Views: 19184 | Post Order: 40



Write for us






Hosting Recommendations