 <p>When you say:-</p> <pre><code>var _db = new PortOfTroyCustomers.Models.PortOfTroyContext(); </code></pre> <p>The compiler infers the type of the expression to the right of the assignment, this is known as implicit type in C#.</p> <p>Now, you are trying to assign, your query like this, we have <code>System.Data.Entity.DbSet</code> on right &amp; <code>System.Linq.IQueryable</code> on left which are different types:- </p> <pre><code>IQueryable&lt;Accommodation&gt; query = _db.Accommodations; </code></pre> <p>Thus, you need an explicit typecast like this:-</p> <pre><code>IQueryable&lt;Accommodation&gt; query = (IQueryable&lt;Accommodation&gt;)_db.Accommodations; </code></pre>