Understanding Code first approach in mvc?
Can anyone help me to understand the Code first approach in mvc?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Saineshwar BageriRank #115 · 19.6K reputationPosted Nov 18, 2015, 8:18 PM EST
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:-