I’m writing an application with ASP.NET MVC2. In the tutorial I’m following for registration, the author mentions mapping a database table to my User class to make it easy to insert the user once they pass validation checks, but he doesn’t explain how to do that.
These are the attributes of my User class:
public string Username { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public string ConfirmPassword { get; set; }
They have DataAnnotation validations as well. I also made a database table on a remote server (hosted at my University) called Users which has the following fields:
Id
Username
Email
Password
How can I map them and then easily save the user to the database?
Thanks.
You can use some well known ORM solutions out there. I would recommend Entity Framework. This code project example is good place to start