Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more granular configuration of batch size #12443

Open
Tracked by #22959
justhoma-zz opened this issue Jun 21, 2018 · 4 comments
Open
Tracked by #22959

Allow more granular configuration of batch size #12443

justhoma-zz opened this issue Jun 21, 2018 · 4 comments

Comments

@justhoma-zz
Copy link

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:

            DECLARE @inserted4 TABLE ([REC_ID] int, [_Position] [int]);
            OUTPUT INSERTED.[REC_ID], i._Position
            INTO @inserted4

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

@ErikEJ
Copy link
Contributor

ErikEJ commented Jun 21, 2018

I think you can try to set MaxBatchSize to 1

@justhoma-zz
Copy link
Author

This would impact all updates...correct? Is it possible to do this at a more granular level?

@ajcvickers 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
@ajcvickers
Copy link
Contributor

Triage: Putting this on the backlog to allow maximum batch size to be set with more granularity--probably per table.

@ajcvickers ajcvickers added this to the Backlog milestone Jun 27, 2018
@jzabroski
Copy link

Can you post sample repro code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants