Book a Demo

Author Topic: Visual Studio 2010; EA and C# keyword 'delegate'  (Read 6141 times)

ceatley

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Visual Studio 2010; EA and C# keyword 'delegate'
« on: August 27, 2010, 08:02:24 am »
delegate code at the namespace level (global code outside of any class) doesn't import.

Checked by coding an enum next to the delegate code.  The enum imported; the delegate didn't

Also there doesn't appear to be a way of modeling a delegate at this level.

Delegates work fine when in a class.

A delegate object at the global level is legal.

Question:  Am I doing something wrong or have I found a bug?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Visual Studio 2010; EA and C# keyword 'delegat
« Reply #1 on: August 27, 2010, 08:13:17 am »
You show me a way to include it from the UML spec and we can look at including it.  At the moment it's not imported because it doesn't fit in UML.

ceatley

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Re: Visual Studio 2010; EA and C# keyword 'delegat
« Reply #2 on: August 28, 2010, 05:49:09 am »
Check this site out!

Quote
Class with a «C# Delegate» stereotype. The invocation method and its signature are mapped using a UML operation within this class. The name of this operation is the same as the class. Its signature is the signature of the delegate. By default, this delegate class will derive from System.Delegate or System.MultiCastDelegate.

http://publib.boulder.ibm.com/infocenter/rsahelp/v8/index.jsp?topic=/com.ibm.xtools.viz.dotnet.doc/topics/r_cs_mapping.html

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Visual Studio 2010; EA and C# keyword 'delegat
« Reply #3 on: August 28, 2010, 07:27:19 pm »
Hey,  quoting big blue, that'll do it ;-)

Actually, what ya says is a way to represent a delegate in a UML way; not how UML states a delegate should be ( UML is a little behind the times in that respect.... LINQ is another, but Sparx squirms outa that one with 'we dont do method body thingies" ... lambda?).

If you have more than one in the global scope, do you have a class for each delegate?

Kevin [smiley=2vrolijk_08.gif]

ceatley

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Re: Visual Studio 2010; EA and C# keyword 'delegat
« Reply #4 on: August 29, 2010, 12:21:21 am »
I would say so, as the class name is the same as the delegate name. Same as an enum

So the bottom line seems to be that EA is one to one UML, but there appears to be some addons that expand EA beyond core UML
« Last Edit: August 29, 2010, 12:26:27 am by ceatley »

ceatley

  • EA User
  • **
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Re: Visual Studio 2010; EA and C# keyword 'delegat
« Reply #5 on: September 01, 2010, 09:09:23 am »
I just did some more research and found that 'delegate'  causes the compilier to generate a class, with the delegates name, derived from the class MulticastDelegate.  That means that the Model is a class with the delegate stereotype as I mentioned earlier.  The only thing that EA has to do is to take a UML compliant class and generate the appropriate code at the global level. And generate a class in the model for reverse engineering.  delegate is already available at the instance level. So there should not be any problem with allowing it the same scope as a class object.