I am trying to set display attribute to column in T4.
This
LoadSqlServerMetadata("127.0.0.1,1433", "dataBase");
Tables["Contract"].Columns["ContractTermInDays"].AliasName = "Contract terms in days";
GenerateModel();
generates alias variable. I want something like
LoadSqlServerMetadata("127.0.0.1,1433", "dataBase");
Tables["Contract"].Columns["ContractTermInDays"].**DisplayAttribute **= "Contract terms in days";
GenerateModel();
and get it in code
string displayAttribute = typeof(Contract).GetFieds[0].GetAttribute("DisplayAttribute").ToString();
Please, help to achieve this! May be I need to use something else? I just want to obtain another name of column from generated code by T4 template.
This is ok:
Tables["Contract"].Columns["ContractTermInDays"].Description = "Contract Term In Days";
but I can’t obtain it in code…
Of course I can use Dictionary<ColumnName, DisplayName>
, but I want to know more about linq2db.
Thank you.
Can’t find anything useful in google or either on linq2db github repo.
0
I found the solution. In T4 you need to write
Tables["Contract"].Columns["ContractTermInDays"].Attributes.Add(new Attribute("MyDisplayName", ""Contract Term In Days""));
but how i can find this? where i can read about syntax of T4 for linq2db?