Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations: Compile error when using complex types #31665

Closed
bricelam opened this issue Sep 8, 2023 · 0 comments · Fixed by #31666
Closed

Migrations: Compile error when using complex types #31665

bricelam opened this issue Sep 8, 2023 · 0 comments · Fixed by #31666
Assignees
Labels
area-migrations closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@bricelam
Copy link
Contributor

bricelam commented Sep 8, 2023

With the following model...

public class Entity
{
    public int Id { get; set; }
    public required Point Location { get; set; }
}

[ComplexType]
public class Point
{
    public int X { get; set; }
    public int Y { get; set; }
}   

...adding a migration generates the following code in the snapshot.

b.ComplexProperty<Dictionary<string, object>>("Location", "Entity.Location#Point", b1 =>
    {
        .IsRequired()
        b1.Property<int>("X")
            .HasColumnType("int");

        b1.Property<int>("Y")
            .HasColumnType("int");
    });

It should be as follows

  b.ComplexProperty<Dictionary<string, object>>("Location", "Entity.Location#Point", b1 =>
      {
-         .IsRequired()
+         b1.IsRequired();
          b1.Property<int>("X")
              .HasColumnType("int");

          b1.Property<int>("Y")
              .HasColumnType("int");
      });

This bug is present in 8.0 RC 1.

@bricelam bricelam added type-bug closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. area-migrations labels Sep 8, 2023
@bricelam bricelam self-assigned this Sep 8, 2023
bricelam added a commit to bricelam/efcore that referenced this issue Sep 8, 2023
@bricelam bricelam added this to the 8.0.0-rc2 milestone Sep 8, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0-rc2, 8.0.0 Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-migrations closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants