Visual Paradigm Logo
     Build Quality Applications Faster, Better and Cheaper
 
Home | Products | Download | Documentation | Support | Resources | Partners | Quick Tour | Shop | Company |  
 
   Visual Paradigm Discussion Forum
  Login   [ Register ] Email: Password: Log me on automatically I lost my password  
Advanced Search
Issues with C# code generation  
Forum Index -> Customizing Code Generation
Author Message
Juanso


Joined: 2007/11/06
Messages: 2

Offline

I've a little problem. When I'm generation c# code I always get a number "2" after my asociation name.
I've looking forward to resolve this, but is a dead end.
The problem is with method $associationEnd.getVariableName(); on association.vm, in csharp templates folder.
If we look a little bit more we should be able to find that DotNetAssociationEnd.java on lib\vpplatform\com\vp\instantgenerator\dotnet folder, inside vpplatform.jar (since I think that is a common library for C# and VBNet) have the method with the problem.
My question is, we could get a fix on this problem?
If not, there is something on Velocity to make a substring?
Thank you.
Best regards.

Juan.
 
Juanso


Joined: 2007/11/06
Messages: 2

Offline

Well, I solved
For anyone that could need it the code of association.vm below.
Best regards.

Juan.

#if($associationEnd.isNavigable() && !$associationEnd.getReferencedAttribute())
#set($orginal=$current)
#set($current=$associationEnd)
###################### Comment Start ######################
#parse("$template-path/comment.vm")
###################### Comment End ######################
${indent}#parse("$template-path/visibility.vm")
#parse("$template-path/member.vm")
#set ($lastItemIndex = $associationEnd.getVariableName().length() - 1 )
$associationEnd.getVariableType() $associationEnd.getVariableName().substring(0,$lastItemIndex);
#if($associationEnd.isProvideGetterMethod() || $associationEnd.isProvideSetterMethod())
${indent}public $associationEnd.getVariableType() $associationEnd.getPropertyName() {
###################### Getter Start ######################
#if($associationEnd.isProvideGetterMethod())
${indent}${tab}get{
${indent}${tab}${tab}return $associationEnd.getVariableName().substring(0,$lastItemIndex);
${indent}${tab}}
#end
###################### Setter Start ######################
#if($associationEnd.isProvideSetterMethod())
${indent}${tab}set{
${indent}${tab}${tab}$associationEnd.getVariableName().substring(0,$lastItemIndex) = value;
${indent}${tab}}
#end
${indent}}
#end
#set($current=$orginal)
#end
 
 
   Forum Index -> Customizing Code Generation
Go to:   
Powered by JForum 2.1.4 © 2005 - Rafael Steil