I am following a video on MVVM.
There I have written a simple method by following the steps in video as follows :
[OperationContract]
public IEnumerable<Patient> GetPatients()
{
using (Lab_Lite_Entities db = new Lab_Lite_Entities())
{
var result = db.Patients.ToList();
result.ForEach(p => db.Detach(p)); //I get an error here.
return result;
}
}
But I get an error as follows:
Lab_Lite_Data.Lab_Lite_Entities does not contain a definition for 'Detach' and no
extension method 'Detach' accepting a first argument of type
'Lab_Lite_Data.Lab_Lite_Entities' could be found
(are you missing a using directive or an assembly reference?)
I have added a reference to System.Data.Entity
and EntityFramework
.
I am using Entity Framework 6.0
.