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 7510107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:07:51+00:00 2026-05-29T23:07:51+00:00

I am designing a Data Information Interface Layer. I want the users of this

  • 0

I am designing a Data Information Interface Layer. I want the users of this layer to be not aware of the Data Source and still use the goodness of LINQ syntax. I want to use standard LINQ providers as implementation of this layer and want to avoid writing Custom LINQ provider

Consider following Example.

The Information Interface Layer is declared as following

interface IMyData
{
    int Intdata { get; }
    double DoubleData { get; }
}


interface IMyDataProviderLayer
{
    IQueryable< IMyData > Context { get; }
}

and in Client code that uses this layer

    //dataProvider implements IMyDataProviderLayer
var dataCollection = from data in dataProvider.Context
                                 where data.Intdata == 5
                                 select data;

The interface implementation will access the data from real data source and needs to use the standard LINQ providers.

Is it possible to do something like above? Do I need to implement LINQ provider from scratch even the Data Source has standard LINQ implementations?
Or Is there a better way to achieve what I am trying to do here?
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-29T23:07:53+00:00Added an answer on May 29, 2026 at 11:07 pm

    I think you are looking for something like a Repository Pattern. You would have an interface as follows:

    public interface IMyRepository
    {
        IEnumberable<MyObject> GetObjects();
    }
    

    Implementation(use dependency injection here):

    public class MyRepository : IMyRepository
    {
        private Context dbContext;
    
        IEnumberable<MyObject> GetObjects()
        {
             return dbContext.MyObjects;
        }
    }
    

    Use:

    var dataCollection = from data in repository.GetObjects()
                                 where data.Intdata == 5
                                 select data;
    

    You may also use IQueryable instead of IEnumerable in you repository. I explained some difference between the 2 here. But basically, the IQueryable has the SQL get generated and sent to the database while IEnumerable calls the database then does the query in memory.

    This way, you may change out the ORM from LINQ to SQL to entity framework or anything that can abstract the query to IQueryable or IEnumerable.

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

Sidebar

Related Questions

I'm designing a Data Access layer for an C#/ASP.net application and I have a
I'm designing an interface to display sets of data. I'm interested in organizing the
While designing a new WPF application I noticed exceptions not being thrown during data
I am designing an application in C# and I want to use some Crystal
I have this task of designing a new interface for a distributed application (multiple
I'm designing a system which is receiving data from a number of partners in
I'm designing an application that reads data to the iPod touch/iPhone that is sent
I am designing an app in which the data is stored in the database.
I am designing a simple internal framework for handling time series data. Given that
I am designing a web app and I intent to embed data on an

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.