Controlling output of reserved types?

Posts   
 
    
tangent
User
Posts: 41
Joined: 30-Apr-2006
# Posted on: 18-Mar-2008 06:19:53   

Is there any easy way to have the generator output type keywords , ie

int instead of System.Int32 short? instead of Nullable<System.Int16>

etc..

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39773
Joined: 17-Aug-2003
# Posted on: 18-Mar-2008 11:15:03   

Not easily. We chose the official type names because they're the same for all .NET languages, so we could store the type info inside the mapping information in the project. So the code generator emits the .NET type name as-is.

If you REALLY want this, you can alter the TDL interpreter sourcecode and change the case clause for TypeOfField at line 1591 of TDLInterpreter.cs (v2.5 code). It doesn't generate nullable<T> though, that's controlled inside the template: See for example line 621 of entityIncludeAdapter.template.

I wonder why you would spend time on this though, as it won't give you any extra value, only extra maintenance: int is a synonym for System.Int32, short? is a synonym for Nullable<System.Int16>

Frans Bouma | Lead developer LLBLGen Pro
tangent
User
Posts: 41
Joined: 30-Apr-2006
# Posted on: 19-Mar-2008 05:45:35   

I am using the engine to generate interfaces and other code which will be edited by hand and I find the type names detract from readability, if you use resharper code highlighting it highlights keywords a special color but not reserved types.

Also I wrap everything in a Property<> to add transaction support and other features, and Property<Nullable<System.Int32>> is really ugly.

Up until now I have been using regex to replace them but I figured it would be more convenient to do it in the template. The TypeOfField line is what I was looking for, thanks Frans simple_smile