title: Entity Framework with Instead Of triggers
body: <p>I am using EF with a SQL Server database. I created a view and an <code>Instead Of Insert</code> trigger for that view which looks like this:</p>
  
  <pre><code>insert into Target (value, someFk) 
  select value, 4 from inserted
  select id from Target where @@ROWCOUNT &gt; 0 and id = scope_identity() 
  </code></pre>
  
  <p>I mapped the view into an EF edmx. When I try to add an entity I get the following exception when I call <code>SaveChanges()</code>:</p>
  
  <blockquote>
    <p><em>Unable to update the EntitySet 'TargetView' because it has a DefiningQuery and no  element exists in the
     element to support the current
    operation.</em></p>
  </blockquote>
  
  <p>The view has an identity column marked in the mapping.</p>
  
  <p>Any suggestions?</p>