Linq2db scaffolding and association naming

731 Views Asked by At

I've tried to scaffold an existing database using the t4 file as described here

Now I've found that the relation I've have really ugly looking naming,consider this case

/// <summary>
    /// FK_XX_CONVENZIONI_XX_COMPAGNIE_BackReference
    /// </summary>
    [Association(ThisKey="IdCompagnia", OtherKey="IdCompagnia", CanBeNull=true, Relationship=Relationship.OneToMany, IsBackReference=true)]
    public IEnumerable<BenefitConvenzioni> XXCONVENZIONIXXCOMPAGNIEs { get; set; }

I've tried as suggested to put

 GetSchemaOptions.GetAssociationMemberName = key => "Association_" + key.MemberName; 

But it doesn't change the behavior... any suggestion?

1

There are 1 best solutions below

2
On BEST ANSWER

You have to put this code before LoadMetadata

GetSchemaOptions.GetAssociationMemberName = key => "Association_" + key.MemberName; 

// other tweaks

LoadMetadata(....)

It is also mentioned in documentation Configuring generation process