I am new to Entity Framework.
I have get to some values in my database using EF. It returns perfectly, and the values are shown in labels. But When I delete all valu
Firstly I would not suggest modifying the database external to your system unless you are only doing testing and development.
The EF DbContext contains an IDisposable interface. To release any cached data either make the Dispose calls manually or place your Database Object inside a using block.
using (SchoolBriefcaseEntities datamodel = new SchoolBriefcaseEntities())
{
List compliance = new List();
IList complianceModel;
if (HttpContext.Current.User.IsInRole("SuperAdmin"))
{
compliance = datamodel.Compliances.Where(c => c.School.DistrictId == districtId).ToList();
}
}
This will make sure the context is cleared and recreated the next time it is used. Make sure to do this for all your calls and not just the one you are having issues with.