We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
SqlConstantExpression
In EFCore 9 the construction of SqlConstantExpression from a ConstantExpression has regressed.
ConstantExpression
// @nuget: Microsoft.EntityFrameworkCore.SqlServer -Version 9.0.0 using System; using System.Linq; using System.Linq.Expressions; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Query.SqlExpressions; using var db = new BloggingContext(); var query = db.Blogs .Select(x => db.Fail()) .ToQueryString(); Console.WriteLine(query); public class BloggingContext : DbContext { public DbSet<Blog> Blogs { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseSqlServer(); protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder .HasDbFunction(typeof(BloggingContext).GetMethod(nameof(Fail))!) .HasTranslation(args => new SqlConstantExpression(Expression.Constant(true), null)); } public bool Fail() => throw new NotSupportedException(); } public class Blog { public int Id { get; set; } }
This snippet emits
SELECT NULL FROM [Blogs] AS [b]
on EFCore 9 and
SELECT CAST(1 AS bit) FROM [Blogs] AS [b]
on EFCore 8.
This regression seems to be caused by fbfd468#diff-31a49e080013a5417ff3104f9a840e3a5693f553c3ee840cdb7c8a4cb8e335f8R46-R50 Apparently the constructor has been marked as Obsolete, but it can still be used (which might be especially problematic if used indirectly, through a dependency).
Obsolete
The text was updated successfully, but these errors were encountered:
Thanks @ranma42 🤦
Sorry, something went wrong.
Fix SqlConstantExpression obsolete constructor
7126694
Fixes dotnet#35355
f163289
Equals
GetHashCode
roji
Successfully merging a pull request may close this issue.
In EFCore 9 the construction of
SqlConstantExpression
from aConstantExpression
has regressed.This snippet emits
on EFCore 9 and
on EFCore 8.
This regression seems to be caused by fbfd468#diff-31a49e080013a5417ff3104f9a840e3a5693f553c3ee840cdb7c8a4cb8e335f8R46-R50
Apparently the constructor has been marked as
Obsolete
, but it can still be used (which might be especially problematic if used indirectly, through a dependency).The text was updated successfully, but these errors were encountered: