EF Core Sqlite - Migration doesn't apply configuration when [NotMapped] property is added to one of the DbSets
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Hi,
I am getting different output for migration files when I include [NotMapped] property to one of the DbSets.
When I call migration I get:
```
migrationBuilder.CreateTable(
name: "Defects",
columns: table => new
{
Id = table.Column(type: "varchar(36)", nullable: false),
LastModifiedDateUtc = table.Column(type: "bigint", nullable: false),
LastClientModifiedDateUtc = table.Column(type: "bigint", nullable: true),
WorkStepId = table.Column(type: "varchar(36)", nullable: true)
},
```
When I add not mapped entity to one of the DbSets,:
```
[NotMapped]
public IEnumerable Entries => Defects.Cast().Concat(Expenses);
```
Then when I delete migration and create new one the output of the new migration is:
```
migrationBuilder.CreateTable(
name: "Defects",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
LastModifiedDateUtc = table.Column(type: "TEXT", nullable: false),
LastClientModifiedDateUtc = table.Column(type: "TEXT", nullable: true),
WorkStepId = table.Column(type: "varchar(36)", nullable: true)
},
```
Which is completely different, and I added only [NotMapped] property.
In order to fully reproduce bug I created repo:
https://github.com/mhenkrich-wh/EntityFrameworkCore_Bug_11_27_24
Steps to reproduce:
1. Build -> Add migration "Add-migration **test1**" -> inspect migration.
2. In file WorkStep.cs comment out lines 22 and 23 (this mapped property)
3. Delete current migration
4. Build -> Add migration "Add-migration **test2**" -> inspect migration.
You can see that **test1** migration output doesn't match **test2** migration output.
To me it seems like custom configuration is not applied.
Contributor guide
Assessment
This issue has not been assessed yet.