dotnet / dotnet/EntityFramework.Docs

Document how to create an editor.config to suppress warnings in migrations files

Open
#4,380 3 comments 1 reaction 0 assignees View on GitHub
area-migrations
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

The new CA1861 warning added in .net 8 preview 5 added a bunch of warnings to my existing solution, complaining about generated migrations files. Based on my understanding of the warning and how migrations are used, I don't think the recommendation makes sense in context.

For example this generated migration code:
```
migrationBuilder.CreateIndex(
name: "IX_MyTable_DbId_TypeId_SourceId",
table: "MyTable",
columns: new[] { "DbId", "TypeId", "SourceId" },
unique: true);
```

The `columns:` line triggers the warning.

I can suppress it for the full migrations folder with a `.editorconfig` no problem, but I think it would be nice if the migrations could handle this themselves during generation

It would be nice if generated migrations would suppress CA1861 to prevent build warnings in solutions containing migration files

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.