You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+39-2Lines changed: 39 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
12
12
- Use the rules defined in the .editorconfig file in the root of the repository for any ambiguous cases
13
13
- Write code that is clean, maintainable, and easy to understand
14
14
- 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
16
16
- Add license header to all files:
17
17
```
18
18
// 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
48
48
- Use `var` for local variables
49
49
- Use expression-bodied members where appropriate
50
50
- 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)`)
52
52
- Prefer `switch` expressions over `switch` statements when appropriate
53
+
- Prefer pattern matching with `when` clauses in switch expressions for conditional logic
53
54
- Prefer field-backed property declarations using field contextual keyword instead of an explicit field.
54
55
- Prefer range and index from end operators for indexer access
55
56
- The projects use implicit namespaces, so do not add `using` directives for namespaces that are already imported by the project
@@ -89,6 +90,8 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
89
90
- Create both unit tests and functional tests where appropriate
90
91
- Fix `SQL` and `C#` baselines for tests when necessary by setting the `EF_TEST_REWRITE_BASELINES` env var to `1`
91
92
- Run tests with project rebuilding enabled (don't use `--no-build`) to ensure code changes are picked up
93
+
- When testing cross-platform code (e.g., file paths, path separators), verify the fix works on both Windows and Linux/macOS
94
+
- When testing `dotnet-ef` tool changes, create a test project and manually run the affected commands to verify behavior
92
95
93
96
#### Environment Setup
94
97
-**ALWAYS** run `restore.cmd` (Windows) or `. ./restore.sh` (Linux/Mac) first to restore dependencies
@@ -110,6 +113,13 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
110
113
-**ALL** user-facing error messages must use string resources from the `.resx` (and the generated `.Designer.cs`) file corresponding to the project
111
114
- Avoid catching exceptions without rethrowing them
112
115
116
+
## Dependency and Version Management
117
+
118
+
-**NEVER** hardcode package versions in `.csproj` files
119
+
- Check `eng/Versions.props` for existing version properties (e.g., `$(SQLitePCLRawVersion)`) before adding or updating package references
120
+
- Use `Directory.Packages.props` for NuGet package version management with Central Package Management (CPM)
121
+
- Packages listed in `eng/Version.Details.xml` are managed by Maestro dependency flow and should not be updated manually or by Dependabot
122
+
113
123
## Asynchronous Programming
114
124
115
125
- Provide both synchronous and asynchronous versions of methods where appropriate
@@ -129,6 +139,7 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
129
139
130
140
- Write code that is secure by default. Avoid exposing potentially private or sensitive data
131
141
- 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
142
+
- After implementing a fix, review the surrounding code for similar patterns that might need the same change
132
143
133
144
### Entity Framework Core Specific guidelines
134
145
@@ -153,6 +164,32 @@ If you are not sure, do not guess, just tell that you don't know or ask clarifyi
153
164
- .github/: GitHub-specific files, workflows, and Copilot instructions
154
165
- .config/: AzDo pipelines configuration files
155
166
167
+
## Pull Request Guidelines
168
+
169
+
-**ALWAYS** target the `main` branch for new PRs unless explicitly instructed otherwise
170
+
- For servicing PRs (fixes targeting release branches), use the following PR description template:
171
+
```
172
+
Fixes #{issue_number}
173
+
174
+
**Description**
175
+
{Brief description of the issue and fix}
176
+
177
+
**Customer impact**
178
+
{How does the reported issue affect customers? Are there workarounds?}
179
+
180
+
**How found**
181
+
{Was it customer reported or found during verification? How many customers are affected?}
182
+
183
+
**Regression**
184
+
{Is it a regression from a released version? Which one?}
185
+
186
+
**Testing**
187
+
{How the changes were tested}
188
+
189
+
**Risk**
190
+
{Low/Medium/High, with justification}
191
+
```
192
+
156
193
## Overview of Entity Framework Core
157
194
158
195
Entity Framework Core (EF Core) is an object-database mapper for .NET. Below is a concise summary of its core architecture and concepts:
0 commit comments