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

  • SEARCH
  • Home
  • 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 6835413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:13:46+00:00 2026-05-26T23:13:46+00:00

I am very new to OData (only started on it yesterday) so please excuse

  • 0

I am very new to OData (only started on it yesterday) so please excuse me if this question is too dumb 🙂

I have built a test project as a Proof of Concept for migrating our current web services to OData. For this test project, I am using Reflection Providers to expose POCO classes via OData. These POCO classes come from in-memory cache. Below is the code so far:

public class DataSource
{
    public IQueryable<Category> CategoryList
    {
        get
        {
            List<Category> categoryList = GetCategoryListFromCache();
            return categoryList.AsQueryable();
        }
    }
    // below method is only required to allow navigation
    // from Category to Product via OData urls
    // eg: OData.svc/CategoryList(1)/ProductList(2) and so on
    public IQueryable<Category> ProductList
    {
        get
        {
            return null;
        }
    }
}

[DataServiceKeyAttribute("CategoryId")]
public class Category
{
    public int CategoryId { get; set; }
    public string CategoryName { get; set; }
    public List<Product> ProductList { get; set; }
}

[DataServiceKeyAttribute("ProductId")]
public class Product
{
    public int ProductId { get; set; }
    public string ProductName { get; set; }
}

To the best of my knowledge, OData is going to use LINQ behind the scenes to query these in-memory objects, ie: List in this case if somebody navigates to OData.svc/CategoryList(1)/ProductList(2) and so on.

Here is the problem though: In the real world scenario, I am looking at over 18 million records inside the cache representing over 24 different entities.

The current production web services make very good use of .NET Dictionary and Hashtable collections to ensure very fast look ups and to avoid a lot of looping. So to get to a Product having ProductID 2 under Category having CategoryID 1, the current web services just do 2 look ups, ie: first one to locate the Category and the second one to locate the Product inside the Category. Something like a btree.

I wanted to know how could I follow a similar architecture with OData where I could tell OData and LINQ to use Dictionary or Hashtables for locating records rather than looping over a Generic List?

Is it possible using Reflection Providers or I am left with no other choice but to write my custom provider for OData?

Thanks in advance.

  • 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-05-26T23:13:46+00:00Added an answer on May 26, 2026 at 11:13 pm

    You will need to process expression trees, so you will need at least partial IQueryable implementation over the underlying LINQ to Objects. For this you don’t need a full blown custom provider though, just return you IQueryable from the propties on the context class.
    In that IQueryable you would have to recognize filters on the “key” properties (.Where(p => p.ProductID = 2)) and translate that into a dictionary/hashtable lookup. Then you can use LINQ to objects to process the rest of the query.
    But if the client issues a query with filter which doesn’t touch the key property, it will end up doing a full scan. Although, your custom IQueryable could detect that and fail such query if you choose so.

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

Sidebar

Related Questions

Very new to python and can't understand why this isn't working. I have a
Im very new in C++ I have found this post http://msdn.microsoft.com/en-us/magazine/cc163486.aspx and trying to
Very new to this, and I have no idea where to start. I want
im very new to this and have a very basic knowledge php and SQL
Very new to web programming still and I don't really have a specific question
Very new to python, trying this - def newlines(): print() print() print() question =
Very new to jQuery, if dupe question sorry at this point not even sure
Im very new to game development on the iPhone... And I have a question:
Very new to extjs 4.0. So i could be phrasing this incorrectly. I have
Very new, so let me know if this is asking too much. I am

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.