Why isn't DbContext compiling?

.net c# compiler-errors entity-framework

Question

I'm constructing a music store and following a step-by-step tutorial to learn MVC, but for some reason I can't get the following code to function.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace MvcMusicStore.Models
{
    public class MusicStoreEntities : DbContext
    {
        public DbSet<Album> Albums { get; set; }
        public DbSet<Genre> Genres { get; set; }
    }
}

There are issues with the DBcontext, DbSet, and DbSet.

Error 1 The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)

why?

1
5
2/25/2013 9:03:21 PM

Accepted Answer

You must include a mention of theEntityFramework.dll construction for your project. Installing the appropriate NuGet bundle is the quickest method to do this. When you start a new project, the Tools Update for ASP.NET MVC 3 NuGet package is automatically referenced if you have it installed. Install it if not already done.

5
7/14/2011 9:46:10 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow