title: LINQ - changing Data Source (and the LINQ Provider) at runtime in C#
body: <p>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</p>
  
  <p>Consider following Example.</p>
  
  <p>The Information Interface Layer is declared as following</p>
  
  <pre><code>interface IMyData
  {
      int Intdata { get; }
      double DoubleData { get; }
  }
  
  
  interface IMyDataProviderLayer
  {
      IQueryable&lt; IMyData &gt; Context { get; }
  }
  </code></pre>
  
  <p>and in Client code that uses this layer</p>
  
  <pre><code>    //dataProvider implements IMyDataProviderLayer
  var dataCollection = from data in dataProvider.Context
                                   where data.Intdata == 5
                                   select data;
  </code></pre>
  
  <p>The interface implementation will access the data from real data source and needs to use the standard LINQ providers.</p>
  
  <p>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.</p>