title: Web Api returning NullReferenceException using repository
body: <p>I am trying to call in to a repository method to fetch some data, which be returned from a Web Api 'Get' request.</p>
  
  <pre><code>public class BookRepository : IBookRepository
  {
      public Book GetBookInfo()
      {
          return new Book
          {
              Title = "Book1",
              Chapters = new List&lt;string&gt;
                    {
                        "Chapter1",
                        "Chapter2",
                        "Chapter3",
                        "Chapter4"
                    }
          };
  </code></pre>
  
  <p>My apicontroller:</p>
  
  <pre><code>public class BooksController : ApiController
  {
      private readonly IBookRepository _repository;
  
      public BooksController () { }
  
      public BooksController (IBookRepository repository)
      {
          this._repository = repository;
      }
  
      // GET api/books
      public Book Get()
      {
          return _repository.GetBookInfo();
      }
  </code></pre>
  
  <p>The issue is that when I navigate to this in the browser e.g. '<a href="http://localhost:49852/api/books" rel="nofollow">http://localhost:49852/api/books</a>' I am getting a NullReferenceException. Please can you explain why and how to rectify?</p>