[ECO5/Mdlr] .Net attributes not supported on modeled elements?
CapableObjects Forums
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



[ECO5/Mdlr] .Net attributes not supported on... Expand / Collapse
Author
Message
Posted 2010-03-16 10:03:09
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 14:42:04
Posts: 102, Visits: 755
ECO seems to be unaware of .Net attributes applied to method parameters and will just silently remove them if you change the name of the parameter for example (and generate code).
We used property attributes in our applications with ECO4 and now in ECO5 I don't see a way to apply attributes to properties. Is this a bug, or am I missing something here?

I think http://www.capableobjects.com/apps/InstantForum414/FindPost4915.aspx asks the same questions.


/Pawel
Post #5013
Posted 2010-03-19 00:22:51
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230, Visits: 1 382
For ECO6, I have added the following:

If a tagged value has the name that starts with a "*" (like "*MyTag"), it will be generated as a standard .net attribute (without the "*"), and if the value is "[true]", it will ignore the value and generate the attribute without parameters, any other tag-value will be generated as constructor parameters to the attribute.

Modlr doesn't support adding tagged values to parameters in a method. If you need custom attributes on parameters, you can add the method directly in code instead of in the model. The drawback will be that you can't call it in OCL/EAL, and it will not show in your design model.


/Jonas Hogstrom [CapableObjects]
Post #5015
Posted 2010-03-19 12:53:08
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 14:42:04
Posts: 102, Visits: 755
If a tagged value has the name that starts with a "*" (like "*MyTag"), it will be generated as a standard .net attribute (without the "*"), and if the value is "[true]", it will ignore the value and generate the attribute without parameters, any other tag-value will be generated as constructor parameters to the attribute.

Sounds a bit like workaround. Why not add a type of the "Tag" and generate all tags as .net attributes of the specified type? Or alternatively provide separate list for .net attributes (where value can be empty and * is not required)? Hope our SA will catch the ECO6 train :-).


/Pawel
Post #5025
Posted 2010-03-19 12:58:23
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Today @ 14:42:04
Posts: 102, Visits: 755
Is this functionality present in the published daily builds?

/Pawel
Post #5026
Posted 2010-03-19 22:54:13
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: 2010-11-30 12:17:13
Posts: 1 230, Visits: 1 382
I agree it is a bit of a workaround. using the tagged value mechanism is very convenient as it allows you to define tag-extensions and have the property show up in the property-window. I'll give it some more thought and see if we can come up with something that looks a little more elegant.

This is in the daily ECO6 builds. We have not changed the key for ECO6 yet, but will do so at some point. valid SA will give you an ECO6 key when we do. Your ECO5 key will be valid for the current releases, but you have to enter it again in the ECO about box. Stability of the ECO6 builds could vary. be warned.


/Jonas Hogstrom [CapableObjects]
Post #5028
Posted 2011-04-04 01:53:51
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2011-04-08 16:06:32
Posts: 2, Visits: 9
Has anything changed with this functionality yet?  I'm curious how you would decorate an attribute with [Browsable(false)] for e.g.  Using *Browsable is OK, but the false ends up as "false" which causes a compile error.  Is there a way to suppress the quotes?
Post #6070
Posted 2011-04-05 01:30:29
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: 2011-11-18 23:48:32
Posts: 139, Visits: 410
Derek Newton (2011-04-04)
Has anything changed with this functionality yet? I'm curious how you would decorate an attribute with [Browsable(false)] for e.g. Using *Browsable is OK, but the false ends up as "false" which causes a compile error. Is there a way to suppress the quotes?


Yes, It would be a LOT better if the code generator did not put any quotes in the parameter list. Let me put quotes around the string parameters. The code generator should take the list of parameters as entered and place it between the attributes (parenthesis).

Can this get changed before ECO 6 is released?
Post #6071
Posted 2011-04-07 17:36:17
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 20:21:00
Posts: 421, Visits: 2 536
I have updated the implementation to check for likely types - it now supports bool, int, double, datetimes and strings - so if not perfect it is a lot better and Browsable(false) is not a problem:

Tag *Browsable
Value false

(The reason for us not just taking any string and pasting it in there is because we generate the code thru the code dom interfaces - this way VB.NET, Delphi.NET and c# are solved with one call)

Post #6080
Posted 2011-04-07 21:11:12
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 2011-04-08 16:06:32
Posts: 2, Visits: 9
Thank you, this will be a welcome improvement.  How will things like

[TypeConverter(typeof(SomeSpecialConverter))]

be handled?  Currently the quotes are inserted when using *TypeConverter.  I obviously have not tried your fix yet (since it's probably not posted yet), but from the description I doubt it addresses these types of Tags of which there are many examples which I imagine are fairly commonly used.  Maybe there is a trick I'm missing?

Post #6081
Posted 2011-04-07 22:18:24
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 20:21:00
Posts: 421, Visits: 2 536
No the new build will not cover that case. It will cover cases where the arguments are simple types.

Consider add method or attribute wrappers in the user code file (class.cs) and but code attributes there as a workaround.

As I said before we are happy with using the code dom api - but it does not allow us to paste in strings.

Post #6082
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: HansKarlsen, Jonas Hogstrom, PeterMorris

Permissions Expand / Collapse

All times are GMT +1:00, Time now is 9:26

Powered By InstantForum.NET v4.1.4 © 2012
Execution: 0,328. 8 queries. Compression Disabled.