[Question] Parent Child Reference convention

Hi, I was looking at the Reference Support, POCO style example on the documentation, and I wanted to know if it could be possible to explicitly specify the field for Parent-Child relationship, instead of using the {Parent}Id convention.

Something like:

public class MyParent {
    public int Id {get;set;}
    
    [Reference]
    public List<MyChild> Childrens {get;set;}
}

public class MyChild {
    public int Id {get;set;}
    
    [References(typeof(MyParent), nameof(MyParent.Childrens))]
    public int IdOfMyParent {get;set;}
}

Thanks

EDIT: I’m asking this question because I already have properties that represent the ParentId, that don’t match the requested convention.

The only solution it comes to my mind is to create a property named using the {Parent}Id convention, that maps to the original parentId property, as:

public class MyChild {
   // Key
   public int Id {get;set;}

   // My actual Parent Id
   public int IdOfMyParent {get;set;}

   // Convention key
   [Ignore on table attribute]
   public int MyParentId{
     get => IdOfMyParent;
     set => IdOfMyParent = value;
   }
}

Would this work?

You can use the [References] attribute to specify the table the FK references, see docs for examples: