|
|
Rank: Newbie
Joined: 7/27/2007 Posts: 4 Location: Canada
|
Hello,
We often use aliases to namespaces in our C# code.
Example: Code:using DL = Acme.DataLayer;
We then use the alias to declare member variables, such as: Code:DL.SQL.Command cmd = new DL.SQL.Command();
When reverse-engineering a .NET C# project, this results in having all these alias becoming "Unknown Externals" and of course the links, such as associations and dependencies are not mapped to the appropriate objects.
Any idea how to resolve this? using aliases in C# is very convenient and I don't see us dropping this practice. However it then involves us retyping the datatypes in the class diagrams, and, of course if we were to re-merge the model into the code, we'd loose the declarations with the aliases.
Thank you kindly for your response
|
|
Rank: Advanced Member
Joined: 9/28/2005 Posts: 371 Location: Vienna
|
Hello Nikdo!
Sorry, but currently there is no other way of handling aliases.
|
|
Rank: Advanced Member
Joined: 9/28/2005 Posts: 371 Location: Vienna
|
Hello Nikdo!
You again mentioned this question from another thread, so I would like to attach a small sample here to show why aliases are really tricky - just think of defining
file1.cs:
Code: using System; using MYALIAS = System.Text; namespace MyWindowsApplication { partial class Class1 { MYALIAS.StringBuilder property2 = new MYALIAS.StringBuilder(); } }
and file2.cs:
Code: using System; using MYALIAS = System.Collections.Generic; namespace MyWindowsApplication { partial class Class1 { MYALIAS.List<int> property1 = new MYALIAS.List<int>(); } }
=> Within the same class in the same namespace, you can have two completely different usages of alias "MYALIAS"!
|
|
Rank: Member
Joined: 9/12/2008 Posts: 11
|
Will the "alias limitation" be an ongoing issue in the next release of UModel?(I'm assuming this is still an issue today)
|
|
Rank: Advanced Member
Joined: 9/28/2005 Posts: 371 Location: Vienna
|
Hello abelfiore!
We already have this on our list, but maybe you want to tell us a bit more what exactly you would like to have / expect?
Referencing the example above: What would you expect that classes of "DL" should be e.g. in an UML class diagram? Own classes ? Not visible at all?... When should a property point its associations to classes of "DL", when to those of "Acme.DataLayer" ?...
|
|
Rank: Member
Joined: 9/12/2008 Posts: 11
|
The example you give seems to be an exceptional condition, but one that must be considered.
Would it be possible to handle these edge cases as you do now? And then provide support (resolution) for the more common scenario (where there is no collision)?
In other words, if there are no collisions, then things resolve nicely. Else, the "unknown externals" is used, as it is today.
--Tony
|
|
Rank: Member
Joined: 9/12/2008 Posts: 11
|
I was wondering if the new version of UModel (2009) supports namespace aliases? Any information would be appreciated
--Tony
|
|
Rank: Advanced Member
Joined: 9/28/2005 Posts: 371 Location: Vienna
|
Hi all!
UModel2010 will resolve aliases.
|
|
Rank: Member
Joined: 9/12/2008 Posts: 11
|
When is the "expected" release date for 2010?
|
|
Rank: Advanced Member
Joined: 12/13/2005 Posts: 2,856 Location: Mauritius
|
There is no expected release date, but we are working hard...
|
|
Rank: Advanced Member
Joined: 9/28/2005 Posts: 371 Location: Vienna
|
Hi all!
just for info: As promised, UModel2010 has an option to resolve aliases.
For newly imported projects this options is turned on by default (but can be changed on the import page). If you want to enable this for existing projects, you can change the Project Settings accordingly.
|
|
Rank: Newbie
Joined: 12/22/2009 Posts: 8 Location: Canada
|
Thanks for having corrected that.
I currently do not use aliases. But a key reason for me to buy a product is to see that the product company still continue to improve their product and fix major error. To me, this bug was a major one.
I'm hoping a lot from you guys !!! Actually, you seems to be the only company with a good UML product for .Net. (But at this time of writing, with few bugs).
|
|
Rank: Advanced Member
Joined: 9/28/2005 Posts: 371 Location: Vienna
|
Once you start with aliases you might recognize that both makes sense even within one project: the aliased view and the resolved view. Thus this is an option and can be changed at any time during modeling.
Anyway – UModel (as all Altova products) is continuously improved and extended and we have always an open ear for good, useful, clearly defined suggestions - especially when made in a professional and friendly way :-)
|
|
|
guest |