Book a Demo

Author Topic: Generation of Associations as a Property  (Read 4077 times)

dirc

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Generation of Associations as a Property
« on: January 19, 2006, 01:57:02 am »
When I define an Association and define a target Role, I can set it to private or public.

What I really want to be able to do is to set it to private and automatically generate a Property for this field.

Further to this, it would be able to be able to optionally set the property to only have a Setter. The reason for this is that I am creating a 0.* association and I want the collection class to be a read only property.

Can anyone give me some pointers as to how to best acheive this?

Many thanks
dirc

thomaskilian

  • Guest
Re: Generation of Associations as a Property
« Reply #1 on: January 19, 2006, 02:09:58 am »
You can create getters/setters from within the attribute creation. Once you have attributes you can select them from the drop down in associations. It is not possible to create an attribute from a value entered in an association.

dirc

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Generation of Associations as a Property
« Reply #2 on: January 19, 2006, 04:20:52 am »
I know this is not standard behaviour.. I was thinking something along the lines of changing the way the code for an association is generated.

I will put this forward as a feature request.. until then has anyone any clever schemes to get this done?
dirc

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Generation of Associations as a Property
« Reply #3 on: January 19, 2006, 01:09:54 pm »
Try using the transformation templates.

The default C# and Java templates do part of what you want, but I'm guessing you want to do a bit more.

Start with that, if it's C# add a readonly tag to the property created if using a collection class (in the Linked Attribute template) and you could even automatically generate add/remove remove methods.

dirc

  • EA User
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Generation of Associations as a Property
« Reply #4 on: January 21, 2006, 06:53:12 am »
OK... done it.. does anyone want the template? ;D
dirc

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Generation of Associations as a Property
« Reply #5 on: January 21, 2006, 07:54:57 am »
Yes please

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Generation of Associations as a Property
« Reply #6 on: January 22, 2006, 01:28:31 pm »
The EA user group site (http://www.eausergroup.org/) is available for uploading templates etc.  If you want to share a resource for EA that you have made, it is the best place to go.