Entity Framework 6 - mapping only one statement in a stored procedure

I map the entity to be inserted into the stored procedure as follows:

modelBuilder  
  .Entity<Member>()  
  .MapToStoredProcedures(s =>  
       s.Insert(u => u.HasName("stp_insert_member")));

The insert works fine and passes all the parameters to the stored procedure while saving the new member.

But what happens when I try to update an element (loading an object from db by id, changing its properties and again saving what the update statement will throw), I get an exception because it is looking for a stored procedure with the name Member_Update.

But for this (and for deletion) I do not want to have stored procedures. I just want to execute the stored procedure for the insert statement.

Is it possible to map an EF to a stored procedure for an insert action only?

+4
1

All Articles