Open Closed

ABP Suite: Inconsistent naming of navigation properties #3291


User avatar
0
ageiter created
  • ABP Framework version: v5.3.0 (Stable)
  • UI type: Blazor-Server
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: -

Steps to reproduce the issue:

  1. Use ABP Suite to generate entities
  2. Create 2 navigation properties to the same entity
  3. Go to "Advanced" and change "Property Name" in section "3 Others" to a meaningful name
  4. Save and generate the code

Current result: The properties with the foreign key (Guid) are generated correctly with my specified name. But in the classes with postfix "...WithNavigationProperties" and "...WithNavigationPropertiesDto" the entity name is used and numbered. It would be desirable that the chosen name would be used there as well.

My expectation: In all classes where this property is used, my chosen name will be used as property name. The property name chosen for the foreign key should also be used for the navigation property (without the "Id" postfix). If necessary to define separatly with another field in the ABP Suite form.

Example: The class "Book.cs" should have two navigation properties to "Author.cs": MainAuthorId & CoAuthorId

Result in BookDto.cs, Book.cs, ...

public Guid? MainAuthorId { get; set; } 
public Guid? CoAuthorId { get; set; }

Result in BookWithNavigationPropertiesDto.cs / BookWithNavigationProperties.cs:

using BookStore.Author;
using BookStore.Author;

public Author Author { get; set; } 
public Author Author1 { get; set; }

The other bug is that the "using" is added twice (as seen above). I have seen this several times and would find it useful to check if the "using" is already present before adding it.

I hope my concern has been explained in an understandable way.

Thanks, Adrian


1 Answer(s)
  • User Avatar
    2
    yekalkan created
    Support Team Fullstack Developer

    Hi @ageiter,

    Thanks you for the feedback. We'll create internal issues about those and fix it in the future releases.

    I've refunded your question credit.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11