using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using ModelLayer.PocoModels;
using System.Data.Objects;
namespace ModelLayer
{
public class NorthwindDataContext : ObjectContext
{
private ObjectSet<Category> _categories;
private ObjectSet<Product> _products;
public NorthwindDataContext()
: base("name=NorthwindEntities",
"NorthwindEntities")
{
_categories = CreateObjectSet<Category>();
_products = CreateObjectSet<Product>();
}
}
}
In the above code I get an error as it cant find the ObjectSet
class and gives me type or namespace not found error.While in the sample project it works fine it is under using System.Data.Objects.ObjectSet
but I dont see that library in my current project? I am using asp.net mvc and .net 4.0. Does anyone have any good ideas ?
Make sure your project has a reference to System.Data.Entity
.
You may also need references to System.Runtime.Serialization
and System.Security
.
Visual Studio adds these for you automatically when you add an EDMX file (ADO.NET Entity Data Model) to your project.