KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am VERY new to ASP.NET MVC (3) and am having a hard time resolving a build error in Visual Studio: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.ComponentModel.DataAnnotations; using System.Data.Entity; namespace MyProjectName.Models { public class MachineModel { // name [Required] [Display(Name = "Nom de la machine")] public string Name { get; set; } // IP [Required] [RegularExpression(@"(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", ErrorMessage = "Donnez une adresse IPv4 valide.")] [Display(Name = "Adresse IP de la machine")] public string IP { get; set; } } public class MachineDbContext : DbContext { public DbSet<MachineModel> Machines{ get; set; } } } The two errors I am getting are: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?) The type or namespace name 'DbSet' could not be found (are you missing a using directive or an assembly reference?) What am I missing?
Tags (comma-separated)
Save Edits
Cancel