title: Showing a many-to-many relationship from in a GridView using the Repository pattern with Code First
body: <p>I have a WebForms Application using a EF 4.1 - Code First for the Data Layer.  I have a many-to-many relationship.</p>
  
  <pre><code>public class Application
  {
      public Application()
      {
          Administrators = new List&lt;User&gt;();
      }
  
      public long Id { get; set; }
  
      public string Name { get; set; }
  
      public virtual ICollection&lt;User&gt; Administrators { get; set; }
  }
  
  public class User
  {
      public User()
      {
          Administrates = new List&lt;Application&gt;();
      }
  
      public long Id { get; set; }
  
      public string FirstName { get; set; }
  
      public string LastName { get; set; }
  
      public string Username { get; set; }
  
      // Collections
      public virtual ICollection&lt;Application&gt; Administrates { get; set; }
  }
  </code></pre>
  
  <p>Assuming the configuration is setup correctly, is there a way to implement an ObjectDataSource bound to a GridView in order to show who the administrators are for each application entity, with one record row per administrator.  Right now I am using a SqlDataSource with a View and StoredProcs to tackle this problem, but I would like to stick to one architecture pattern for my data layer.</p>