KleeGroup / kinetix-tools

Toolbox for Kinetix
Apache License 2.0
1 stars 2 forks source link

[ModGen] Change the way you can extend DO_ALIAS naming #7

Open c3dr0x opened 6 years ago

c3dr0x commented 6 years ago

When generating a DTO with multiple DO_ALIAS that references columns of entities with the same name you need to use the alias' role feature. But it generates the code with a form of ColumnRole which is reverse from the others patterns. It should be something like PreColumnPost to be complete and more coherent with the rest of the application.

c3dr0x commented 6 years ago

I have a DTO named MyResult that reference the Title property of both ParentA & ParentB

class ParentA 
{
    public string Title { get; set; }
}

class ParentB
{
    public string Title { get; set; }
}

To make sure that I reference known columns I want to use DO_ALIAS to generate them

image

The generated DTO will then looks like the following code extract. Which is problematic because two properties can't have the same name. By default it uses the source object property name.

class MyDto
{
    public string Title { get; set; }

    public string Title { get; set; }
}

The DO_ALIAS offers an escape:

image

Then, the generated object will be:

class MyDto
{
    public string TitleParentA { get; set; }

    public string TitleParentB { get; set; }
}

I'm not comfortable with that solution because it does not correspond to the way naming conventions works with kinetix. When you add a link between two tables it is always with a reverse order of what is proposed here : ExternalTableId or ExternalTableCode.

I want to be able to do the same here using DO_ALIAS.

Have an evolution like what follows:

see : https://github.com/get-focus/kinetix-tools/commit/9481d74a9a530d0094958c6914c43f94eb0cea97