title: How to return self parent and child with repository pattern in ASP net core API C#?
body: <p><a href="https://i.stack.imgur.com/pFL2j.png" rel="nofollow noreferrer">My Question</a>. I have a table called category, this table had this column { ID, ParentId, name }. The ParentId is the same Id, as an example for this table:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">Id</th>
  <th style="text-align: center;">ParentId</th>
  <th style="text-align: right;">Name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: center;">NULL</td>
  <td style="text-align: right;">Mobile</td>
  </tr>
  <tr>
  <td style="text-align: left;">2</td>
  <td style="text-align: center;">1</td>
  <td style="text-align: right;">IPhone</td>
  </tr>
  <tr>
  <td style="text-align: left;">3</td>
  <td style="text-align: center;">1</td>
  <td style="text-align: right;">Android</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">2</td>
  <td style="text-align: right;">Accessorice</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Like that, I need to return data using generic repository pattern in net core ape like:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">ID</th>
  <th style="text-align: center;">NAme</th>
  <th style="text-align: right;">ParentName</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">2</td>
  <td style="text-align: center;">Iphone</td>
  <td style="text-align: right;">Mobile</td>
  </tr>
  <tr>
  <td style="text-align: left;">3</td>
  <td style="text-align: center;">Iphone</td>
  <td style="text-align: right;">Mobile</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">Accessories</td>
  <td style="text-align: right;">iPhone</td>
  </tr>
  </tbody>
  </table>
  </div>