DeleteObject does not exist in Context

asp.net, entity-framework

Solution

With `DbContext` you can use `DbSet<T>.Remove` instead of `ObjectContext.DeleteObject` which has the same purpose to delete entities from the database:

using (var context = new Entities())
{
    (from ur in context.Module_Users_Info
     where ur.UserID == comarg
     select ur)
    .ToList()
    .ForEach(ur => context.Module_Users_Info.Remove(ur));
}

Problem

i am using vs 2012 and dot net 4, i have a model folder that contains my model in my page " Default.aspx " i used ``` > using MyProjectName.Model; ``` but when i am trying to delete some data it says " DeleteObject " Method does not exist! ``` using (var context = new Entities()) { (from ur in context.Module_Users_Info where ur.UserID == comarg select ur).ToList().ForEach(context.DeleteObject); } ```

Original source