Skip to content

Commit 750f993

Browse files
authored
Merge branch 'main' into merge/release/10.0-to-main
2 parents 1460789 + 1d245f3 commit 750f993

File tree

925 files changed

+47025
-25309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

925 files changed

+47025
-25309
lines changed

.azuredevops/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: 2
2+
3+
# Disabling dependabot on Azure DevOps as this is a mirrored repo. Updates should go through github.
4+
enable-campaigned-updates: false
5+
enable-security-updates: false

.github/CODEOWNERS

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths.
22
# See https://help.github.com/articles/about-code-owners/
33

4-
/azure-pipelines.yml @AndriySvyryd @cincuranet
5-
/azure-pipelines-public.yml @AndriySvyryd @cincuranet
6-
/github-merge-flow.jsonc @AndriySvyryd @cincuranet
7-
/global.json @AndriySvyryd @cincuranet
8-
/NuGet.config @AndriySvyryd @cincuranet
4+
/azure-pipelines.yml @AndriySvyryd
5+
/azure-pipelines-public.yml @AndriySvyryd
6+
/azure-pipelines-internal-tests.yml @AndriySvyryd
7+
/github-merge-flow.jsonc @AndriySvyryd
8+
/global.json @AndriySvyryd
9+
/NuGet.config @AndriySvyryd
910
/.config/ @AndriySvyryd
1011
/.github/ @dotnet/efteam
11-
/eng/ @AndriySvyryd @cincuranet
12+
/eng/ @AndriySvyryd
1213
/src/ @dotnet/efteam
14+
/test/ @dotnet/efteam

.github/ISSUE_TEMPLATE/04_feature_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 💡 Feature request
22
description: Suggest an idea for this project.
33
labels: ["customer-reported"]
4+
type: feature
45
body:
56
- type: textarea
67
id: problem

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Please check whether the PR fulfills these requirements
33
-->
44

5-
- [ ] I've read the guidelines for [contributing](CONTRIBUTING.md) and seen the [walkthrough](https://youtu.be/9OMxy1wal1s?t=1869)
5+
- [ ] I've read the guidelines for [contributing](https://github.com/dotnet/efcore/blob/main/.github/CONTRIBUTING.md) and seen the [walkthrough](https://youtu.be/9OMxy1wal1s?t=1869)
66
- [ ] I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
77
- [ ] The code builds and tests pass locally (also verified by our automated build checks)
88
- [ ] Commit messages follow this format:

.github/copilot-instructions.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
1212
- Use the rules defined in the .editorconfig file in the root of the repository for any ambiguous cases
1313
- Write code that is clean, maintainable, and easy to understand
1414
- Favor readability over brevity, but keep methods focused and concise
15-
- Only add comments rarely to explain why a non-intuitive solution was used. The code should be self-explanatory otherwise
15+
- **Prefer minimal comments** - The code should be self-explanatory. Add comments sparingly and only to explain *why* a non-intuitive solution was necessary, not *what* the code does. Comments are appropriate for complex logic, public APIs, or domain-specific implementations where context would otherwise be unclear
1616
- Add license header to all files:
1717
```
1818
// Licensed to the .NET Foundation under one or more agreements.
@@ -48,8 +48,9 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
4848
- Use `var` for local variables
4949
- Use expression-bodied members where appropriate
5050
- Prefer using collection expressions when possible
51-
- Use `is` pattern matching instead of `as` and null checks
51+
- Use `is` pattern matching instead of `as` followed by null checks (e.g., `if (obj is SomeType typed)` instead of `var typed = obj as SomeType; if (typed != null)`)
5252
- Prefer `switch` expressions over `switch` statements when appropriate
53+
- Prefer pattern matching with `when` clauses in switch expressions for conditional logic
5354
- Prefer field-backed property declarations using field contextual keyword instead of an explicit field.
5455
- Prefer range and index from end operators for indexer access
5556
- The projects use implicit namespaces, so do not add `using` directives for namespaces that are already imported by the project
@@ -75,6 +76,7 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
7576
- Use nullable reference types
7677
- Use proper null-checking patterns
7778
- Use the null-conditional operator (`?.`) and null-coalescing operator (`??`) when appropriate
79+
- Don't disable nullability with a preprocessor directive (`#nullable disable`)
7880

7981
## Architecture and Design Patterns
8082

@@ -89,6 +91,8 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
8991
- Create both unit tests and functional tests where appropriate
9092
- Fix `SQL` and `C#` baselines for tests when necessary by setting the `EF_TEST_REWRITE_BASELINES` env var to `1`
9193
- Run tests with project rebuilding enabled (don't use `--no-build`) to ensure code changes are picked up
94+
- When testing cross-platform code (e.g., file paths, path separators), verify the fix works on both Windows and Linux/macOS
95+
- When testing `dotnet-ef` tool changes, create a test project and manually run the affected commands to verify behavior
9296

9397
#### Environment Setup
9498
- **ALWAYS** run `restore.cmd` (Windows) or `. ./restore.sh` (Linux/Mac) first to restore dependencies
@@ -110,6 +114,13 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
110114
- **ALL** user-facing error messages must use string resources from the `.resx` (and the generated `.Designer.cs`) file corresponding to the project
111115
- Avoid catching exceptions without rethrowing them
112116

117+
## Dependency and Version Management
118+
119+
- **NEVER** hardcode package versions in `.csproj` files
120+
- Check `eng/Versions.props` for existing version properties (e.g., `$(SQLitePCLRawVersion)`) before adding or updating package references
121+
- Use `Directory.Packages.props` for NuGet package version management with Central Package Management (CPM)
122+
- Packages listed in `eng/Version.Details.xml` are managed by Maestro dependency flow and should not be updated manually or by Dependabot
123+
113124
## Asynchronous Programming
114125

115126
- Provide both synchronous and asynchronous versions of methods where appropriate
@@ -129,6 +140,7 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
129140

130141
- Write code that is secure by default. Avoid exposing potentially private or sensitive data
131142
- Make code NativeAOT compatible when possible. This means avoiding dynamic code generation, reflection, and other features that are not compatible with NativeAOT. If not possible, mark the code with an appropriate annotation or throw an exception
143+
- After implementing a fix, review the surrounding code for similar patterns that might need the same change
132144

133145
### Entity Framework Core Specific guidelines
134146

@@ -153,6 +165,10 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
153165
- .github/: GitHub-specific files, workflows, and Copilot instructions
154166
- .config/: AzDo pipelines configuration files
155167

168+
## Pull Request Guidelines
169+
170+
- **ALWAYS** target the `main` branch for new PRs unless explicitly instructed otherwise
171+
156172
## Overview of Entity Framework Core
157173

158174
Entity Framework Core (EF Core) is an object-database mapper for .NET. Below is a concise summary of its core architecture and concepts:

.github/dependabot.yml

Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
11
version: 2
2-
registries:
3-
nuget.org:
4-
type: nuget-feed
5-
url: https://api.nuget.org/v3/index.json
62
updates:
7-
- package-ecosystem: nuget
8-
directory: /
3+
- package-ecosystem: "nuget"
4+
directory: "/"
5+
open-pull-requests-limit: 5
96
schedule:
10-
interval: weekly
11-
allow:
12-
- dependency-name: Azure.Identity
13-
- dependency-name: Castle.Core
14-
- dependency-name: Grpc.AspNetCore
15-
- dependency-name: Humanizer.Core
16-
- dependency-name: IdentityServer4.EntityFramework
17-
- dependency-name: Microsoft.AspNetCore.Identity.EntityFrameworkCore
18-
- dependency-name: Microsoft.AspNetCore.OData
19-
- dependency-name: Microsoft.Azure.Cosmos
20-
- dependency-name: Microsoft.CSharp
21-
- dependency-name: Microsoft.Data.SqlClient
22-
- dependency-name: Microsoft.DotNet.PlatformAbstractions
23-
- dependency-name: Microsoft.SqlServer.Types
24-
- dependency-name: mod_spatialite
25-
- dependency-name: Mono.TextTemplating
26-
- dependency-name: NetTopologySuite*
27-
- dependency-name: Newtonsoft.Json
28-
- dependency-name: SQLitePCLRaw*
7+
interval: "weekly"
8+
labels:
9+
- "area-infrastructure"
2910
ignore:
30-
# Affects minimum required Visual Studio version
31-
- dependency-name: Microsoft.CodeAnalysis.CSharp*
32-
# New analyzer rules would need to be disabled
33-
- dependency-name: DotNetAnalyzers.DocumentationAnalyzers
34-
- dependency-name: StyleCop.Analyzers
35-
# Testing infrastructure should be intentionally updated
36-
- dependency-name: BenchmarkDotNet
11+
# Packages managed by Maestro dependency flow (eng/Version.Details.props)
12+
- dependency-name: "Microsoft.DotNet.Arcade.Sdk"
13+
- dependency-name: "Microsoft.DotNet.Build.Tasks.Templating"
14+
- dependency-name: "Microsoft.DotNet.Helix.Sdk"
15+
- dependency-name: "Microsoft.Extensions.Caching.Memory"
16+
- dependency-name: "Microsoft.Extensions.Configuration"
17+
- dependency-name: "Microsoft.Extensions.Configuration.Abstractions"
18+
- dependency-name: "Microsoft.Extensions.Configuration.EnvironmentVariables"
19+
- dependency-name: "Microsoft.Extensions.Configuration.Json"
20+
- dependency-name: "Microsoft.Extensions.DependencyInjection"
21+
- dependency-name: "Microsoft.Extensions.DependencyModel"
22+
- dependency-name: "Microsoft.Extensions.HostFactoryResolver.Sources"
23+
- dependency-name: "Microsoft.Extensions.Logging"
24+
- dependency-name: "Microsoft.NETCore.App.Ref"
25+
- dependency-name: "Microsoft.NETCore.Platforms"
26+
- dependency-name: "System.Formats.Asn1"
27+
- dependency-name: "System.Runtime.Caching"
28+
- dependency-name: "System.Text.Encodings.Web"
29+
- dependency-name: "System.Text.Json"
30+
31+
- package-ecosystem: "github-actions"
32+
directory: "/"
33+
schedule:
34+
interval: "weekly"
3735
labels:
38-
- area-infrastructure
39-
- 'type-dependency update :arrow_up_small:'
40-
registries: '*'
36+
- "area-infrastructure"

.github/workflows/TestCosmos.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Test Cosmos
22

33
on:
4+
push:
5+
branches:
6+
- main
7+
- feature/*
8+
- release/*
49
pull_request:
510
branches:
611
- main
@@ -20,22 +25,18 @@ jobs:
2025
Start-CosmosDbEmulator -Timeout 540 -NoUI -NoTelemetry -NoFirewall -EnablePreview
2126
2227
- name: Checkout
23-
uses: actions/checkout@v4
28+
uses: actions/checkout@v6
2429

2530
- name: Restore
2631
run: restore.cmd
2732
shell: cmd
2833

29-
- name: Build
30-
run: build.cmd /p:Projects=${{ github.workspace }}\test\EFCore.Cosmos.FunctionalTests\EFCore.Cosmos.FunctionalTests.csproj
31-
shell: cmd
32-
3334
- name: Test on Cosmos
34-
run: test.cmd /p:Projects=${{ github.workspace }}\test\EFCore.Cosmos.FunctionalTests\EFCore.Cosmos.FunctionalTests.csproj
35+
run: dotnet test test/EFCore.Cosmos.FunctionalTests/EFCore.Cosmos.FunctionalTests.csproj
3536
shell: cmd
3637

3738
- name: Publish Test Results
38-
uses: actions/upload-artifact@v4
39+
uses: actions/upload-artifact@v6
3940
if: always()
4041
with:
4142
name: test-results
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test SQL Server
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- feature/*
8+
- release/*
9+
pull_request:
10+
branches:
11+
- main
12+
- feature/*
13+
- release/*
14+
15+
permissions: {}
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-24.04
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
sqlserver_version: [2025, 2022, 2019]
25+
26+
env:
27+
MSSQL_SA_PASSWORD: 'PLACEHOLDERPass$$w0rd'
28+
29+
services:
30+
mssql:
31+
image: mcr.microsoft.com/mssql/server:${{ matrix.sqlserver_version }}-latest
32+
env:
33+
ACCEPT_EULA: Y
34+
SA_PASSWORD: ${{ env.MSSQL_SA_PASSWORD }}
35+
ports:
36+
- 1433:1433
37+
options: >-
38+
--health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -Q 'SELECT 1' -C"
39+
--health-start-period=20s
40+
--health-interval=2s
41+
--health-retries=30
42+
--health-timeout=5s
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v6
47+
48+
- name: Restore
49+
run: ./restore.sh
50+
51+
- name: Test on SQL Server
52+
env:
53+
Test__SqlServer__DefaultConnection: 'Server=localhost;Database=master;User=SA;Password=${{ env.MSSQL_SA_PASSWORD }};Connect Timeout=60;ConnectRetryCount=0;Trust Server Certificate=true'
54+
run: dotnet test test/EFCore.SqlServer.FunctionalTests
55+
56+
- name: Publish Test Results
57+
uses: actions/upload-artifact@v6
58+
if: always()
59+
with:
60+
name: test-results-sqlserver-${{ matrix.sqlserver_version }}
61+
path: artifacts/log/Debug/*
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Copilot Setup Steps"
2+
3+
# See https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
4+
5+
# Automatically run the setup steps when they are changed to allow for easy validation, and
6+
# allow manual testing through the repository's "Actions" tab
7+
on:
8+
workflow_dispatch:
9+
push:
10+
paths:
11+
- .github/workflows/copilot-setup-steps.yml
12+
pull_request:
13+
paths:
14+
- .github/workflows/copilot-setup-steps.yml
15+
16+
permissions: {}
17+
18+
jobs:
19+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
20+
copilot-setup-steps:
21+
runs-on: ubuntu-24.04
22+
23+
# Install SQL Server via a docker container.
24+
# It's better to do this rather than e.g. use a testcontainer, because then the agent can reuse the same container
25+
# and instance of SQL Server rather than have to start it up each time it needs to iterate and run a test.
26+
services:
27+
mssql:
28+
image: mcr.microsoft.com/mssql/server:2025-latest
29+
env:
30+
ACCEPT_EULA: Y
31+
SA_PASSWORD: 'PLACEHOLDERPass$$w0rd'
32+
ports:
33+
- 1433:1433
34+
options: >-
35+
--health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P $SA_PASSWORD -Q 'SELECT 1' -C"
36+
--health-start-period=20s
37+
--health-interval=2s
38+
--health-retries=30
39+
--health-timeout=5s
40+
41+
steps:
42+
- name: Export connection string for the agent's session
43+
run: echo "Test__SqlServer__DefaultConnection=Server=localhost;Database=master;User=SA;Password=PLACEHOLDERPass$$w0rd;Connect Timeout=60;ConnectRetryCount=0;Trust Server Certificate=true" >> "$GITHUB_ENV"

0 commit comments

Comments
 (0)