title: What is the correct way to create a new instance of a object using the repository pattern?
body: <p>I've been playing around with the repository pattern using c# and .net.</p>
  
  <p>my question regards creating new instances of <code>someRepositoryObject</code>. All examples I've seen so far use something like this:</p>
  
  <pre><code>using(ISomeRepository someRepository = new SomeRepository().getRepository())
  {
      IsomeRepositoryObject repObj = new someRepositoryObject();
  }
  </code></pre>
  
  <p>Doesn't calling <code>new someRepositoryObject</code> remove the point of using interfaces in the first place? Would it better to do something like:</p>
  
  <pre><code>using(ISomeRepository someRepository = new SomeRepository().getRepository())
  {
      IsomeRepositoryObject repObj = someRepository.NewsomeRepositoryObject();
  }
  </code></pre>
  
  <p>So the repository itself returns a new instance of the required object and the calling code has no knowledge of the class being passed to it, just that it is of type <code>ISomeRepositoryObject</code>.</p>
  
  <p>This is all new to me, so I might be missing something obvious!</p>
  
  <p>Any help would be appreciated.</p>