Skip to content

Fix EF Core method calls for netcoreapp2.2 in cu-final sample - #37954

Open
SkyDevLab wants to merge 1 commit into
dotnet:mainfrom
SkyDevLab:fix-ef-core-2.2-cu-final-methods
Open

SkyDevLab wants to merge 1 commit into
dotnet:mainfrom
SkyDevLab:fix-ef-core-2.2-cu-final-methods

Conversation

@SkyDevLab

@SkyDevLab SkyDevLab commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes build failures in aspnetcore/data/ef-mvc/intro/samples/cu-final/ContosoUniversity.csproj.

The cu-final sample targets netcoreapp2.2 (EF Core 2.2). In prior PRs (#23398 and #23401), FromSql and ExecuteSqlCommandAsync were updated to EF Core 3.0+ APIs (FromSqlRaw and ExecuteSqlRawAsync), which do not exist in EF Core 2.2 and resulted in CS1061 compiler errors when building the sample:

  • error CS1061: 'DbSet<Department>' does not contain a definition for 'FromSqlRaw'
  • error CS1061: 'DatabaseFacade' does not contain a definition for 'ExecuteSqlRawAsync'

This PR restores FromSql and ExecuteSqlCommandAsync to match the EF Core 2.2 APIs and allow the sample to build cleanly.

The ContosoUniversity cu-final sample targets netcoreapp2.2 (EF Core 2.2), where FromSqlRaw and ExecuteSqlRawAsync do not exist (they were introduced in EF Core 3.0). This was causing CS1061 build errors. Reverting to FromSql and ExecuteSqlCommandAsync to match the EF Core 2.2 APIs and restore compilation.
@SkyDevLab
SkyDevLab requested a review from guardrex as a code owner October 20, 2026 09:28
@guardrex guardrex self-assigned this Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants