IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

.NET Namespace Aliases Options · View
nikdo
Posted: Friday, July 27, 2007 5:48:34 PM
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
cor
Posted: Tuesday, July 31, 2007 11:25:36 AM
Rank: Advanced Member

Joined: 9/28/2005
Posts: 371
Location: Vienna
Hello Nikdo!

Sorry, but currently there is no other way of handling aliases.
cor
Posted: Wednesday, September 19, 2007 6:07:23 AM
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"!
abelfiore
Posted: Monday, October 20, 2008 3:27:25 PM
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)
cor
Posted: Friday, October 24, 2008 12:15:30 PM
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" ?...
abelfiore
Posted: Monday, October 27, 2008 5:40:45 PM
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
abelfiore
Posted: Thursday, June 18, 2009 4:44:25 PM
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
cor
Posted: Friday, June 19, 2009 4:42:37 AM
Rank: Advanced Member

Joined: 9/28/2005
Posts: 371
Location: Vienna
Hi all!

UModel2010 will resolve aliases.
abelfiore
Posted: Friday, June 19, 2009 9:22:25 AM
Rank: Member

Joined: 9/12/2008
Posts: 11
When is the "expected" release date for 2010?
vlad
Posted: Friday, June 19, 2009 11:07:40 AM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
There is no expected release date, but we are working hard...
cor
Posted: Friday, October 30, 2009 1:42:09 PM
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.
Eric Ouellet
Posted: Thursday, January 14, 2010 3:12:50 PM
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).
cor
Posted: Tuesday, January 19, 2010 1:23:34 PM
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 :-)

Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.