DevExpress / DevExpress/DevExtreme.AspNet.Data

Force DataSourceLoader to load data before it is returned from a controller's action

Open
#347 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement has-workaround
Dominant language
C#
Stars
165
Forks
140
Avg merge
1d 2h
Merged PRs (30d)
4

Description

// GET
using (var db = new MyDbContext())
{
    return this.Request.CreateResponse(DataSourceLoader.Load(db.Table0, loadOptions));
}

This code throws ObjectDisposedException because the MyDbContext instance is disposed of before the inner query is executed.

Related:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the shown controller action with a disposed MyDbContext and DataSourceLoader.Load(db.Table0, loadOptions), then inspect how the returned query is executed. Done means the action can dispose the context without an ObjectDisposedException while still returning the loaded data; add or update a regression test if the repository provides a suitable test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.