Understanding Code first approach in mvc?
Can anyone help me to understand the Code first approach in mvc?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Saineshwar BageriPosted Nov 19, 2015, 1:18 AM
Code first
In Code first approach we are going to write POCO classes first and according to that the database will be created.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace MVCCodefirst.Models
{
public class EmployeeDetails
{
[Key]
public int EmpID { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public Nullable Age { get; set; }
public Nullable Salary { get; set; }
public string worktype { get; set; }
}
}
In details refer this URL:-