Author Topic: Configure and Override Attribute Initialisers  (Read 2528 times)

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Configure and Override Attribute Initialisers
« on: March 17, 2004, 03:30:18 pm »
What does this context menu item do?

I can see it annotates the initial value of an attribute in the diagram, but it doesn't do anything in termns of code generation.  Or am I expecting something that doesn't exist?

Suppose we have two classes "abstractFish" and "RainbowTrout:abstractFish".  abstractFish has an property attribute "CommonName" with an intial value of "Fishy".  RainbowTrout specialises abstractFish, inheriting all operations and properties, but we want to override the "CommonName" property initialiser to "Rainbow Trout".  

The code generator produces:
Quote
public abstract class abstractFish {
      private string Genus = "Fishy";
      private string Species = "Fishy";
      private string CommonName = "Fishy";

      public abstractFish(){
      }
...etc

and
Quote
public class RainbowTrout : abstractFish {
      public RainbowTrout(){

      }
      public static override string CommonName {
            get{
                  return CommonName;
            }
            set{
                  CommonName = value;
            }
      }
}//end RainbowTrout


So, what is the "Configure and Override Attribute Initialisers" for, if not to generate code?

Bruce

p.s. Guess what I'd rather be doing.
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.