Batching through a table variable may not work for non-default collations

Open
#7,172 10 comments 3 reactions 1 assignee View on GitHub

@AndriySvyryd is already working on this.

Since Dec 7, 2016.

Assessment

This issue has not been assessed yet.

Description

area-save-changes area-sqlserver

(copied from @seriouz's comment at https://github.com/aspnet/EntityFramework/issues/6577#issuecomment-264244982)

I have a database with some columns collations set to be case sensitive. Now EF build its query with a temp table, but this temp table does not have the collation on the column so on the insert the database server throws an exception.
Until there is a work-around i can not use ef because the regarding columns contain (case sensitive) guids.

I think @seriouz meant to say SaveChanges() fails, as opposed to querying data.

A possible workaround is to disable batching in either the OnConfiguring() method on the DbContext class or on the AddDbContext() method in Startup:

    optionsBuilder => optionsBuilder
        .UseSqlServer(connectionString)
        .MaxBatchSize(1);

cc @AndriySvyryd as FYI

Dominant language
C#
Stars
14.8k
Forks
3.4k
Avg merge
2d 5h
Merged PRs (30d)
134

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/efcore

All issues in dotnet/efcore

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.