title: Consuming Web API and class information
body: <p>I currently have the following projects in a Visual Studio Solution</p>
  
  <ul>
  <li>MySiteAPI - Web API</li>
  <li>MySiteMVC - MVC 5 template</li>
  </ul>
  
  <p><strong>MySiteAPI</strong> is correctly serving data on <code>http:\\localhost\api</code> and I want to consume that in <strong>MySiteMVC</strong>.</p>
  
  <p><strong>MySiteAPI</strong> currently has <em>Entity Framework Code First</em> classes to handle the data side</p>
  
  <p>I'm confused on how to pull the data into the class definitions on <strong>MySiteMVC</strong> since the definitions are in <strong>MySiteAPI</strong> project and not in <strong>MySiteMVC</strong>. It also appears that Web API can't be called as a Web Reference to get class information, which is where I'm stuck.</p>
  
  <p>I believe this is an architectural problem and want to make sure I understand the proper way to do this before I restructure this project.</p>
  
  <p>I don't want to reference MySiteAPI into MySiteMVC because that sort of defeats separating the two projects. I'm trying to be more robust about this.</p>
  
  <p>Instead of placing the class definitions inside of <strong>MySiteAPI</strong> project, should a <em>class library</em> be created that handles the entity framework for the data which both projects reference?</p>
  
  <p>If so, would the class library contain only the class definitions and <strong>MySiteAPI</strong> project would be the project that does the database operations via a <code>DbContext</code>? This seems to be what makes most sense to me.</p>
  
  <p>In this case there would be three projects</p>
  
  <ul>
  <li>MySiteModels - Holds class definitions</li>
  <li>MySiteAPI</li>
  <li>MySiteMVC</li>
  </ul>
  
  <p>Both <strong>MySiteAPI</strong> and <strong>MySiteMVC</strong> would reference <strong>MySiteModels</strong></p>
  
  <p>Is this a correct way to do this? Is there a more appropriate way?</p>