msawczyn/EFDesigner2022

No "Is Identity" setting when adding a new entity property (version 4.2.44)

Olivercomputing opened this issue · 9 comments

When adding a new entity, then a new property, there is no "Is Identity" setting available for that property. The type is Int64, and Indexed and Indexed Unique are set, but "Is Identity" doesn't appear.

I also see the same problem, for now my workaround is to create a code-1st entity and drag it to designer which make the "is Identity" along with key Icon show, then I can copy-paste that entity inside the designer to create more entities.

GGP305 commented

+1 I'm also geting this behaviour. For the moment i had to reverto the previous version that functions correctly

I'm not able to reproduce that. When adding a new property, after changing the type to Int64,, I get
image

After changing the IsIdentity value to true and generating the code, in OnModelCreating I see

         modelBuilder.Entity<global::TestData.Entity2>()
                     .ToTable("Entity2")
                     .HasKey(t => new { t.Id, t.Property1 });
         modelBuilder.Entity<global::TestData.Entity2>()
                     .Property(t => t.Id)
                     .ValueGeneratedOnAdd()
                     .IsRequired();
         modelBuilder.Entity<global::TestData.Entity2>()
                     .Property(t => t.Property1)
                     .ValueGeneratedOnAdd()
                     .IsRequired();

and the property is declared as

      /// <summary>
      /// Identity, Indexed, Required
      /// </summary>
      [Key]
      [Required]
      public long Property1 { get; set; }

Could you upload an .efmodel file that exhibits the problem?

Thanks.

Please try the same with "Guid" type as primary key - if you still won't be able to reproduce I'll send you an .efmodel file.

I found (and corrected) an issue where the default identity properties weren't being created when a new entity is dragged on to the design surface, but still can't repro the exact issue you've posted. It's possible that something else fixed the problem earlier and it hasn't made it out yet.

I'll be posting a build of v4.2.5 to GitHub here shortly. If you would be kind enough to give that a go and see if it resolves your problem, I'd be most appreciative. It won't go out to the Marketplace yet, but can be installed manually by downloading and "executing" the vsix.

Relki commented

I'm having the same problem. Revisited a dataset I haven't touched in a few months, and went to add a new entity via dragging from toolbox. It didn't automatically create the Id column like it use to with the default Int64 type and Primary key. Adding the Id column manually, didn't have the property available "Is Identity" for me to set. I compared to an existing entity in the designer, and walked down the two Id columns to make them pretty much identically, but nothing triggered the Is Identity column to appear so I could set it.

I can however, copy an existing entity in the designer, edit it and get that column back.

I believe I have the problem diagnosed. My thanks to all for your patience and my apologies for the problem existing. Should be resolved soon.

Relki commented

Thank you very much for fixing this and other reported bugs. I use EF Designer practically every day, so it's an important tool for me.