Starts in:
1 DAY
4 HRS
10 MIN
39 SEC
Starts in:
1 D
4 H
10 M
39 S
Open Closed

Migration 4.2.1 to 4.3: error when regenerate entities with navigation properties AppUserId #1343


User avatar
0
christophe.baille created
  • ABP Framework version: v4.3.0
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: The property 'AppUser.ExtraProperties' could not be mapped because it is of type 'ExtraPropertyDictionary', which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.

I started to migrate a soution from 4.21 to 4.3, then I did notice that when I regenerate entities of my solution, it was creating index and FK to my navigation properties. As it is a good improvement I wanted to regenerate all entities.

It works well for all my entites except the one which have Navigation properties "AppUserId".

I got a long error message (see attachment bellow), the most important seems this:

The property 'AppUser.ExtraProperties' could not be mapped because it is of type 'ExtraPropertyDictionary', which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.

I see this line added on MyProjectDbContextModelCreatingExtensions, into builder.Entity<MyExistingEntity>

b.HasOne<AppUser>().WithMany().HasForeignKey(x => x.AppUserId);

I see some posts about it: https://github.com/abpframework/abp/issues/927 https://github.com/abpframework/abp/issues/1414 https://github.com/abpframework/abp/issues/1517 https://github.com/abpframework/abp/issues/2746

But YourDbContextModelCreatingExtensions.cs is modified by ABP suite just before trying to "generate" my migration script, so I can not test the suggestions

I did some tests and noticed that the error is coming from this line

NOTE: I put a comment to a similar question (without mentionning that it is realted to the update), as it is open since 2 weeks and still not assigned, I post it here.

https://support.abp.io/QA/Questions/1263/abp-suite---AppUser-as-navigation-property-is-not-working

Thanks for your help.


No answer yet!
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06