efcore: Bug when trying to seed with anonymous types

Using: .NET 5 Preview 5.

My model has two int? (optional) values. When I try to seed without those values (optional) in an anonymous type, I get:

The number of values (9) doesn't match the number of columns (11) for the data insertion operation on 'customers'. Provide the same number of values and columns.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Note for triage: I am able to reproduce this. The generated migration contains:

            migrationBuilder.InsertData(
                table: "Customer",
                columns: new[] { "Id", "DocumentTypeId", "Name", "Status" },
                values: new object[] { 1, "Customer Name", true });

@AndriySvyryd Still repros on latest daily. Also, I can’t see how this can be uncommon, so I’m putting it in 5.0 for now. (I may be missing something about why this doesn’t happen more often.)