Hi could you help me with this error?
Cannot access a disposed object.
Object name: DataContext accessed after Dispose. .
页: 1
private void InitializePage()
{
cbCategory.DataSource = stock.StockCategory.Get();
}
缩略语
public IEnumerable<StockCategory> Get()
{
using (leDataContext db = new leDataContext())
{
try
{
var r = from s in db.StockCategories
select s;
return r;
}
catch (Exception ex)
{
Logger.Error(typeof(StockCategory), ex.ToString());
throw;
}
}
}