title: Entity Framework, view and instead of insert trigger. Can't insert a row into the view
body: <p>I can't insert an entity into the mapped view.
  The error I get is: </p>
  
  <blockquote>
    <p>Store, insert or delete statement affected an unexpected number of rows (0)</p>
  </blockquote>
  
  <p>I know how to use stored procedures, but it is more interesting for me to try a solution with an instead of trigger on insert row view event. I don't get any error when I delete, update or insert in t-sql code, but I can't INSERT a row using EF. Update and delete work in EF, but INSERT doesn't.</p>
  
  <p>Code:</p>
  
  <pre class="lang-sql prettyprint-override"><code>create view TestInsert
  as
      select a.table_id, a.name
      from TableA as a
  
  create trigger tr_works_via_tsql_but_not_ef_for_some_reason
  on TestInsert
  instead of isert
  begin
     insert into TableA (table_id, name)
     select table_id, name from inserted;
  end
  </code></pre>
  
  <pre class="lang-csharp prettyprint-override"><code>[Table(TestInsert)]
  public class TestInsert
  {
     [Key]
     public int table_id { get; set; }
     public string name { get; set; }
  }
  </code></pre>
  
  <p>Can anyone help me?</p>