. (, , , ) , DataContext. , DataContext . , , dispose , DataContext.
using (ProjDataContext db = new ProjDataContext()) {
bool hasPassword = (from p in db.tblSpecUser
where p.UserID == userId
select p.HasPassword).FirstOrDefault();
return hasPassword;
}
, db.Dispose() , .
: DataContext ( Reflector) (FW 3.5), DataContext.Dispose:
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (this.provider != null)
{
this.provider.Dispose();
this.provider = null;
}
this.services = null;
this.tables = null;
this.loadOptions = null;
}
}
, :
- ,
DbConnection, (TextWriter) DbTransaction. CommonDataServices.- .
LoadOptions.
, (DbConnection DbTransaction). , TextWriter , , TextWriter DataContext, . FileWriter, .
, , - - , dispose, , .
, , casparOne:
, - .
, , .