Activities of "johnsonlim"

Hi, I successfully create the linkage and able to choose the entity from ABP and my master data module. But then i am not able to click ok button to proceed.Please advise

thanks maliming :)

Yes, i want real navigation property. Please tell me how to do so

[AI-Bot] said:

  • Yes, you can lose (have overwritten) your manual EF Core mapping changes if ABP Suite re-generates the same area again. Suite’s “Save and generate” can rewrite generated files (including the DbContext / entity mapping blocks it generated), so a manual change like switching OnDelete(DeleteBehavior.SetNull) to NoAction/Restrict may be reverted on the next generation.

  • However, your database foreign key will not disappear by itself just because Suite generates more code. The DB schema only changes when you add/apply a new migration (or drop/recreate/update DB). The main risk is: future generation overwrites your mapping, and then your next migration may try to alter the FK behavior again (or you may start getting migration/update failures again).

What to do to avoid losing it

  1. Keep the self-referencing relationship mapping in a place Suite won’t touch, and keep Suite-generated code minimal. Practically:
    • Prefer to configure your self-reference in your own mapping code under OnModelCreating (or the project’s ConfigureYourProjectName() style extension method), not in a file that Suite repeatedly regenerates for the entity.
  2. If you must let Suite generate again, be prepared to re-apply the DeleteBehavior fix after generation (and before creating the next migration).
  3. Version control is your safety net: after any Suite generation, review the diff and restore your custom mapping if Suite overwrote it.

Sources

  • https://abp.io/docs/latest/suite/generating-crud-page
  • https://abp.io/docs/latest/solution-templates/layered-web-application/database-configurations
  • https://abp.io/community/articles/furp75ex

This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

If there is possibilty of code overwritting, shall i proceed?

[AI-Bot] said:

  • ABP Suite can generate “normal” navigation properties (1-N / N-1) between two different entities, but a self-referencing relationship (an entity that has a FK to itself) is not reliably supported by Suite’s CRUD generator. The symptoms you described (not creating the FK/migration as expected, and the custom “Property name” not being persisted especially with a + suffix) are consistent with Suite not handling that scenario well.
  • Workaround (recommended): implement the self-reference manually in your EF Core model and run migrations yourself (you can still use Suite for the rest of the CRUD scaffolding, but don’t rely on it to model this relationship).

Manual self-referencing FK (EF Core) example

Assume entity A should optionally reference a parent A:

1) Domain entity (A.cs)

public class A : AggregateRoot<Guid> 
{ 
    public Guid? ParentAId { get; set; }   // FK column 
    public A? ParentA { get; set; }        // reference nav 
 
    public ICollection<A> ChildAs { get; set; } = new List<A>(); // collection nav 
} 

2) EF Core mapping (in your OnModelCreating / DbContextModelCreatingExtensions)

builder.Entity<A>(b => 
{ 
    b.HasOne(x => x.ParentA) 
     .WithMany(x => x.ChildAs) 
     .HasForeignKey(x => x.ParentAId) 
     .OnDelete(DeleteBehavior.Restrict); // common choice to avoid cascade cycles 
}); 

3) Add migration + update DB Run the standard EF Core migration commands (or use your DbMigrator project) so the column and FK constraint are created.

Important notes for your specific case

  • Do not use special characters like + in property names (Attribute A+). That is not a valid C# identifier and will cause persistence/generation issues in tooling. Use a valid identifier such as ParentA, ParentAId, AttributeAPlus, etc.
  • If you need two separate self-references (e.g., ParentAId and AlternateParentAId), name them explicitly with valid identifiers and map both relationships in EF Core; Suite typically struggles even more with “multiple relationships to the same entity” scenarios.

Sources

  • https://abp.io/docs/latest/suite/generating-crud-page
  • https://abp.io/community/articles/furp75ex

This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

Hi, My another question is that by by doing the changes in code, one day in future, if i use the ABP Suite to generate additional attribute, will i lost the code and the foreign key relation?

Showing 11 to 15 of 15 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 30, 2026, 06:34
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.