title: Using Repository Pattern for two tables without relation
body: <p>How can I use the Repository Pattern in C# to get data from two tables without the relationship setup between them in the database?  For example, I have a table for students and a table for details:</p>
  <pre><code>public class Student{
      public int Id{get;set;}
      public string Name{get;set;}
      public int GenderId{get;set;}
  }
  
  public class DetailsLookup{
      public int Id{get;set;}
      public string Name{get;set;}
  }
  </code></pre>
  <p>I set data for <code>GenderId</code> from <code>DetailsLookup.Id</code> but it doesn't create a relationship between them in the database.</p>
  <p>I'm using the Repository Pattern in my code and Unit of work.  I have an idea to return <code>StudentViewModel</code>.</p>
  <pre><code>public class StudentViewModel{
      public int Id{get;set;}
      public string Name{get;set;}
      public int GenderId{get;set;}
      public int GenderName{get;set;}
  }
  </code></pre>
  <p><a href="https://programmingwithmosh.com/net/common-mistakes-with-the-repository-pattern/" rel="nofollow noreferrer">But based on what I read here</a>, we can't return view models/DTOs from Repositories.</p>
  <p>Can someone help me with this?</p>