Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8204997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:04:28+00:00 2026-06-07T08:04:28+00:00

I am attempting to expose an IQueryable<> over ASP.NET Web API and I find

  • 0

I am attempting to expose an IQueryable<> over ASP.NET Web API and I find that I need to keep the data source open until the request completes, so that the OData query system built into ASP.NET Web API can do its job.

OK, that sounds perfectly reasonable. But where do I dispose of the data source? I do not see any obvious place for this. Should I manage request state in the Application? What is the standard way to do this?

Is the Dispose() method of the controller the appropriate place? I.e. is there a guarantee that one controller instance serves only one request or is that just an implementation detail?

I am using ASP.NET Web API from ASP.NET MVC 4 RC.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:04:29+00:00Added an answer on June 7, 2026 at 8:04 am

    You can use the extension called RegisterForDispose on the HttpRequestMessage to register any resources that you would like to dispose off when a request is done.

    BTW, you might want to look at the following link to regarding IQueryable support in next release of Web API.
    http://aspnetwebstack.codeplex.com/discussions/359229

    [Edited] Doing things in Dispose() method of the Controller would also be a solution. In Web API ApiController based controllers are always per-instance (one controller instance per one request)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to use asp.net mvc's Action Result of File. So it would seem that
I'm attempting to expose a single API call using three different authentication mechanisms: django's
I am attempting to expose documentation (like Javadocs) for a SOAP Service. Best case,
I'm attempting to expose our library via COM but seem to be fighting the
I am attempting to write a C# component which will expose events. The component
Attempting to use the data series from this example no longer passes the JSONLint
Attempting to make a NSObject called 'Person' that will hold the login details for
I'v been attempting to configure my WCF service to expose both SOAP and Json
I'm attempting to write my first custom Cocoa Framework and I want to expose
I've got a Windows Forms control that I'm attempting to wrap as a WPF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.