Open franckleveque opened 4 years ago
Hi, are you sure to use Telosys ver 3.1.2 ?
On Sat, Apr 25, 2020 at 1:49 PM Franck LEVEQUE notifications@github.com wrote:
Hi, Thanks for your great work, However, I'm unable to get primitive types for C# (I'm currently using a database model)
the construct I use is :
$env.setLanguage('C#')
foreach( $attribute in $entity.attributes )
public ${attribute.type} ${attribute.name}
end
I have also tried .fullType, .simpleType, none worked. They are always translated as object types.
ie : public Int32 Id public String Label
whereas I would like to generate : public int Id public string Label
Is there something I'm missing ? Thanks in advance,
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/telosys-tools-bricks/telosys-tools-generic-model/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4IFKSPKFQISYLM5FEAM4DROLE3XANCNFSM4MQW2S3Q .
Hi, It seems I use, the 3.1.2 CLI. the ver command give me this :
Components versions : Telosys CLI : 3.1.2 CLI-001 Telosys API : 3.1.0 Generator : 3.1.2 Generic model : 3.1.2 DSL model : 3.1.0 DB model : 3.0.3 GitHub client : 2.1 HTTP client : 4 (2018-04-09)
Do we need to update the different components separately ?
Your version is correct.
The cause of this behaviour is that in a Database Model the attribute type is still stored as a Java type and this Java type determines the "native or object" nature. It's an "old fashion typing" and it will be aligned on the DSL model in the future version. DBModel types examples : "Short" means "Object type" = "System.Int16" in C# "short" means "Primitive type" = "short" in C# So for the time being you can change the model type (for example use "short" instead of "Short" in the DB model) but it's not applicable for "String"
You can also create a Velocity macro to convert the "model neutral type" into your expected type. The model neutral type is always the same in DBModel and in DSL model : "int", "string", "short", "long", "boolean", "date", "time", etc. You can retrieve an attribute neutral type with : "$attribute.neutralType"
Ok,
Thanks, I will go with neutralType for the moment.
Hi, Thanks for your great work, However, I'm unable to get primitive types for C# (I'm currently using a database model)
the construct I use is :
$env.setLanguage('C#')
foreach( $attribute in $entity.attributes )
end
I have also tried .fullType, .simpleType, none worked. They are always translated as object types.
ie : public Int32 Id public String Label
whereas I would like to generate : public int Id public string Label
Is there something I'm missing ? Thanks in advance,