title: What's the best way to send generic repository via WCF?
body: <p>I have a repository like  this :</p>
  
  <pre><code>public abstract class DbRepository : IDbRepository
  {
      public TEntity Insert&lt;TEntity&gt;(TEntity entity) where TEntity : class
      {
          _context.Entry(entity).State = EntityState.Added;
          return entity;
      }
  
      public TEntity Update&lt;TEntity&gt;(TEntity entity) where TEntity : class
      {
          _context.Entry(entity).State = EntityState.Modified;
          return entity;
      }
  }
  </code></pre>
  
  <p>Service Contract is like : </p>
  
  <pre><code>[ServiceContract]
  public interface IDbRepository
  {
      [OperationContract]
      TEntity Insert&lt;TEntity&gt;(TEntity entity) where TEntity : class;
      [OperationContract]
      TEntity Update&lt;TEntity&gt;(TEntity entity) where TEntity : class;
  }
  </code></pre>
  
  <p>Now I know I cant send this via wcf, I have to make the open generic class clossed.
  But the problem is I have many entities in my Domain data repository and I want it should be decided by the client what entity it is needed may be via reflection or predefined known types.</p>
  
  <p>So my question :
  Is there a smart or fake way to send these generics service via wcf ? 
  My Goal is I dont want to write this servicecontract for each and every entity.
  Many thanks.</p>
  
  <p>Edit: Guys have you seen this  <a href="http://weblogs.asp.net/zareian/archive/2012/05/31/how-to-write-a-generic-service-in-wcf.aspx" rel="nofollow noreferrer">Here</a> Tweak in app.config file below: </p>
  
  <pre><code>&lt;endpoint 
      address="myAddress" binding="basicHttpBinding" 
      bindingConfiguration="myBindingConfiguration1"
      contract="Contracts.IEntityReadService`1[[Entities.mySampleEntity, Entities]],   Service.Contracts"  /&gt;
  </code></pre>
  
  <p>Can somebody please explain this how this contract has been implemented. 
  Has anybody tried to implement this tweak in app.config file. I have tried but not working for me for now. Need helpful answer !</p>