Book a Demo

Author Topic: Code Generation in VB.NET  (Read 2884 times)

Margaret

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Code Generation in VB.NET
« on: May 29, 2009, 12:09:16 am »
I have generated VB.NET code from a simple class diagram.  Unfortunately the code generator names the attribute names for the properties identical to the property names for the getters and setters.  This appears to be illegal syntax in VB.NET.  Is there a way to have the code generator make the attribute names and the property names different?  Thanks!!!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Code Generation in VB.NET
« Reply #1 on: May 29, 2009, 01:32:53 am »
Check the Tools | Options | Source Code Engineering page.

About 2/3 of the way down you'll see a section titled "Remove prefixes..."

Use one of these prefixes when you create the 'internal' field name of your property. [Note that the list is semicolon delimited.]

You also need to check the Property box when you create the field (i.e. attribute) in your class. In the Property dialog you can designate whether this is a read-only property and set other options. You should now have a field (attribute) with a name in the form m_attributeName, and a property with a name in the form of AttributeName.

David
No, you can't have it!

Margaret

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Code Generation in VB.NET
« Reply #2 on: June 02, 2009, 12:21:30 am »
Thanks so much for your response.  I finally had a chance to try it out and your instructions were excellent.