Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Relationship between entities #5894


User avatar
0
antonis created

Hi

I am trying to create two new tables that have a one to many relationship. I am looking at the source code and I can not find how it is done.

e.g cant see where the relationship between AbpEditions table and AppSubscriptionPayments table is set.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @antonis

    The relation is added automatically. You can follow the same approach.

  • User Avatar
    0
    aaron created
    Support Team

    It is set by convention.

    public class SubscriptionPayment : FullAuditedEntity<long>
    {
        public int EditionId { get; set; }
    
        public Edition Edition { get; set; }
        
        // ...
    }
    

    Reference: https://docs.microsoft.com/en-us/ef/core/modeling/relationships#conventions