title: NHibernate View Mapping
body: <p>Consider an application consisting of <code>Employees</code> and <code>Administrators</code>.</p>
  
  <p>An <code>employee</code> consists of an <code>EmployeeId</code>, <code>Name</code> and <code>EmailAddress</code>. </p>
  
  <p>The employees are stored in a legacy system and are readonly so I have an immutable <code>Employee</code> class mapped to a view (<code>vw_Employee</code>) as follows:</p>
  
  <pre><code>[vw_Employee] -&gt; EmployeeID(key), Name, EmailAddress
  </code></pre>
  
  <p>Now for this application, some of the employee's will be marked as administrators (Image a screen with a drop down list of employees, you select one, click add and that employee is now an administrator).</p>
  
  <p>An administrator is an employee (has exactly the same fields) so the database table only needs to look like the following:</p>
  
  <pre><code>[Administrators] -&gt; EmployeeID(key)
  </code></pre>
  
  <p>In the same application, I will need to display a list of all the administrators names and email address</p>
  
  <p>Without NHibernate I could get a list of administrators by joining the <code>[Administrators]</code> table with the <code>[vw_Employee]</code> view using the <code>EmployeeID</code> primary key.</p>
  
  <p>The issue I'm having is what should the <code>Administrator</code> class look like and how would I map this using NHibernate.</p>
  
  <p>Any help would be much appreciated</p>