Skip to content

Migrations: Compile error when using complex types #31665

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

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
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants