Q:

Entity Framework in Visual Studio 2008 missing Add method

I am trying to use Entity Framework in Visual Studio 2008 (.NET 3.5).
I can find it in the Add New Item and it does all it should do(created classes etc.)
But when I try to add a new entity into the database like:
myModel.students.Add(newStudent);

I cannot find Add() method under students object at all!
Is that because I haven't referenced to some nedded dlls?
Or Entity Framework doesn't support Add method in VS2008(.NET 3.5)
To me, it's so weird. I never met this situation before and don't think it should happen.

Update 1:
I also tried to use LINQ2SQL, but still there are no Add, or AddObject/AddEntity methods. There are no anything like AddXXXX() methods.
What happened?

A:

Use the ObjectContext instead and call AddToStudentSet(newStudent).
myModel.AddTostudentSet(newStudent);

You are using an old version of Entity Framework. Back then Entity Framework came bundle with System.Data and wasn't a stand alone library. Instead of having Add/AddObject methods on the DbSet/EntitySet the tool generated add methods directly on the ObjectContext and named them according to the name of the entity.
So an entity called Student would result in a method called AddToStudentSet
Newer versions of EF dropped this approach and instead generate these methods directly on the DbSet.

