Open Closed

Please make creating One-to-many relationship in Suite work! #5569


User avatar
1
Sturla created

Is there a good reason why its not possible to setup one-to-many relationship with Suite?

The current "one-to-many" only creates one-to-one relationship!

This here below gets created when I use the "add one-to-many navigational property" (1-n) from the Suite UI (example is where ScrapingConfiguration that should have many different ScrapingUrlId).

public class ScrapingConfiguration : FullAuditedAggregateRoot<Guid>
{
    [NotNull]
    public virtual string Name { get; set; }
    
    // Navigation property created by Suite that is one-to-ONE and not one-to-many relationship
    public virtual Guid? ScrapingUrlId{ get; set; }
}

But take a look at this question for details (why is it even called one-to-many in the UI?)

@alper answers with

ABP Suite helps to create basic CRUD pages with limited relationship options. if you need further steps, you should manually edit the generated code.

But I know that I can manually do this either by adding code like this

// Navigation property to represent the one-to-many relationship that needs to be manually added
// and one that Suite will remove when Save and create is pressed!
public virtual ICollection< ScrapingUrlId > ScrapingUrlIds{ get; set; }

or by updating the DbContext builder code like suggested here

BUT if I use Suite again it will remove that code every time I update it!

This just must be something that you can add?

p.s

There are lots of questions about this issue but nothing in the docs... I would suggest adding a One-to-many (like you have Many-to-many) part under the Generating a CRUD page


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    We will create an internal issue for this.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on April 16, 2025, 12:13