title: How to migrate to Dependency Injection using repository pattern using very minimal Entity Framework
body: <p>I am trying to migrate to dependency injection using the repository pattern. I am trying to set up my repository pattern by inject the <code>DbCcontext</code> and implementing the method in my interface. My goal is to Get All Work Orders. I have a model called <code>WorkOrder</code> in my <code>DbContext</code>. </p>
  
  <p>Can anyone tell me how I am to implement the method from my interface with code to get all of the work orders?</p>
  
  <pre><code>public class WorkOrderContext : DbContext
  {
      public DbSet&lt;WorkOrder&gt; WorkOrder { get; set; }
  }
  
  public class WorkOrder
  {
      public int UserId { get; set; }
      public string LocationId { get; set; }
      public string Reason { get; set; }
      public bool IsActive { get; set; } = true;
      public DateTime Date { get; set; } = DateTime.Now;
      public string StateId { get; set; } 
  }
  </code></pre>
  
  <p>WorkOrderRepository</p>
  
  <pre><code>public class WorkOrderRepository : IWorkOrderRepository
  {
      //Bringing in Db Context that will be used in Repos; 
      private WorkOrderContext _workOrderContext; 
  
      //Constructor that will inject the Context;
      public WorkOrderRepository(WorkOrderContext workOrderContext)
      {
          _workOrderContext = workOrderContext; 
      }
  
      //Implementing method from Interface; 
      public List&lt;WorkOrder&gt; GetWorkOrders()
      {
          return _workOrderContext.WorkOrder;            
      }
  }
  </code></pre>
  
  <p>Here is my interface: </p>
  
  <pre><code>public interface IWorkOrderRepository
  {
      List&lt;WorkOrder&gt; GetWorkOrders(); 
  } 
  </code></pre>
  
  <p>I am getting an error right here on the </p>
  
  <pre><code>return _workOrderContext.WorkOrder;
  </code></pre>
  
  <p>It says </p>
  
  <blockquote>
    <p>Can't convert type Entity Framework to systems collection generic</p>
  </blockquote>