-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Updating an indexed field is case-insensitive #32638
Comments
Tracked by #32898 |
Let's go further. Let's say we change await using BloggingContext db = new();
await db.Database.EnsureDeletedAsync();
await db.Database.EnsureCreatedAsync();
Blog newBlog = new()
{
Title = "Test",
Url = "http://blogs.msdn.com/ADOnet"
};
db.Add(newBlog);
await db.SaveChangesAsync();
int blogId = newBlog.Id;
Blog blog = await db.Blogs
.Where(blog => blog.Id == blogId)
.FirstAsync();
blog.Title = blog.Title.ToUpperInvariant();
blog.Url = blog.Url.ToUpperInvariant();
await db.SaveChangesAsync();
Blog blogTracked = await db.Blogs
.Where(blog => blog.Id == blogId)
.FirstAsync();
Console.WriteLine($"Tracked: {blogTracked.Url}");
Blog blogUntracked = await db.Blogs
.AsNoTracking()
.Where(blog => blog.Id == blogId)
.FirstAsync();
Console.WriteLine($"Untracked: {blogUntracked.Url}"); Before the second invocation of SaveChangesAsync() I see in
After invocation:
That is, we have |
Closing in favor of #32898. |
Sample
Program
Blog
BloggingContext
After the second invocation of
SaveChangesAsync()
we have different generated SQL-scripts in different versions of EF:Entity Framework 7
Entity Framework 8
So, when we only change the case of an indexed field (Url), the UPDATE operation doesn't include that field in the script:
I didn't find any explanation for this new behavior in the documentation. Is this a bug (I think/hope it is) or an unmentioned breaking change?
Provider and version information
EF Core version: 8.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8
Operating system: Windows 11 Pro
IDE: Visual Studio 2022 17.8.3
The text was updated successfully, but these errors were encountered: