using(ctx e = new ctx())
{
var pkg = from clPkg in e.PkgCoilPkgs.Include("PkgBand")
.Where(c2 => c2.PkgId == PkgID)
select new PkgCoilcls
{
PkgCoilPkg = clPkg,
};
return pkg.FirstOrDefault();
}
PkgBand
is a foreign key table and lazy Loading enabled is set to true
statement: var pkgBand = PkgCoilPkg.PkgBand.Name;
throws
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection" error.
Even though I am using Include("PkgBand")
to load, Why I am getting this error?