You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are running into an issue where EF is creating a merge statement for inserts of multiple records within the same context.
The query runs fine when we are pointed at a physical table, but in our case, our implementation is running an insert against a View.
When executed against SQL Server, we get the following error:
The column reference "inserted.rec_id" is not allowed because it refers to a base table that is not being modified in this statement.
So in order to get the insert to work against the view, we needed to comment out the following from the generated EF statement:
ajcvickers
changed the title
Issue with Merge Statements generated by EF when running an insert against a view
Allow more granular configuration of batch size
Jun 27, 2018
We are running into an issue where EF is creating a merge statement for inserts of multiple records within the same context.
The query runs fine when we are pointed at a physical table, but in our case, our implementation is running an insert against a View.
When executed against SQL Server, we get the following error:
The column reference "inserted.rec_id" is not allowed because it refers to a base table that is not being modified in this statement.
So in order to get the insert to work against the view, we needed to comment out the following from the generated EF statement:
Is there a way to get EF to generate this insert as multiple insert statements? Or Generate the statements without the Declare/Output/Input commands.
Further technical details
EF Core version: 2.0.3
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Win10
IDE: Visual Studio 2017 15.7.4
The text was updated successfully, but these errors were encountered: