Skip to content

Latest commit

 

History

History
86 lines (67 loc) · 4.58 KB

File metadata and controls

86 lines (67 loc) · 4.58 KB

Entity Framework Core 10 Preview 1 - Release Notes

.NET 10 Preview 1 includes new Entity Framework Core features & enhancements:

Entity Framework Core 10 updates:

Support for the .NET 10 LeftJoin operator

LEFT JOIN is a common and useful operation when working with EF Core. In previous versions, implementing LEFT JOIN in LINQ was quite complicated, requiring SelectMany, GroupJoin and DefaultIfEmpty operations in a particular configuration:

var query = students
    .GroupJoin(
        departments,
        student => student.DepartmentID,
        department => department.ID,
        (student, departmentList) => new { student, subgroup = departmentList })
    .SelectMany(
        joinedSet => joinedSet.subgroup.DefaultIfEmpty(),
        (student, department) => new
        {
            student.student.FirstName,
            student.student.LastName,
            Department = department?.Name ?? "[NONE]"
        });

.NET 10 adds first-class LINQ support for LeftJoin method to make those queries much simpler to write. EF Core recognizes the new method, so it can be used in EF LINQ queries instead of the old construct:

var query = students
    .LeftJoin(
        departments,
        student => student.DepartmentID,
        department => department.ID,
        (student, departmentList) => new 
        { 
            student.student.FirstName,
            student.student.LastName,
            Department = department?.Name ?? "[NONE]"
        });

See #12793 for more details.

ExecuteUpdateAsync now accepts a regular, non-expression lambda

Creating expresion trees can be verbose, and now you can use regular, non-expression lambdas when calling ExecuteUpdateAsync:

await context.Blogs.ExecuteUpdateAsync(s =>
{
    s.SetProperty(b => b.Views, 8);
    if (nameChanged)
    {
        s.SetProperty(b => b.Name, "foo");
    }
});

Thanks to @aradalvand for proposing and pushing for this change (in #32018).

Small improvements

  • Translation for DateOnly.ToDateTime(timeOnly) (#35194, contributed by @mseada94).
  • Optimization for multiple consecutive LIMITs (#35384, contributed by @ranma42).
  • Optimization for use of Count operation on ICollection<T> (#35381, contributed by @ChrisJollyAU).
  • Optimization for MIN/MAX over DISTINCT (#34699, contributed by @ranma42).
  • Make SQL Server scaffolding compatible with Azure Data Explorer (#34832, contributed by @barnuri).
  • Translation for date/time functions using DatePart.Microsecond and DatePart.Nanosecond arguments (#34861).
  • Simplifying parameter names (e.g. from @__city_0 to city) (#35200).

Everything else in Preview 1

Preview 1 contains: