3

Attributes provide a powerful method of associating declarative information with C# code (types, methods, properties, and so forth). Once associated with a program entity, the attribute can be queried at run time and used in any number of ways.

[TestClass]
public class MyTests
{
    [TestMethod]
    public void DoSomeTest()
    {
    }
}

In looking the above example, we have MyTest class which has the [TestClass], and the DoSomeTest() which has [TestMethod] attribute.

TestClass and TestMethod both of them are subclass of System.Attribute in C#.

Actually in this example the MyTest class has two dependencies to TestClassAttribute and TestMethodAttribute.

In analyze phase, we produce the results based on UML models. these results also should be able to support code generation for C# compiler. the developer team supposed to implement Asp.Net MVC application type. they implement some parts of the application logic in attributes way. they say the attributes have a lot of advantages. OK.

The problem is that we cant produce the attributes in UML standards. or I don't know!

I tried some solutions such : How do I formally document a C# Attribute in UML

but the drawback of them is that we don't have any constraint or controls on attributes. we can't control consistency of the attributes in our project.

Please answer:

  1. How the UML covers the attributes (C# attributes)?
  2. Is there any UML designer which supports this feature, and what is the best? or which tools you suggest me?

Thanks.

Community
  • 1
  • 1
Ali Adlavaran
  • 3,697
  • 2
  • 23
  • 47

2 Answers2

0

To carry attributes UML offers the use of tagged values. These can be interpreted in code generation.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
0

As for an editor to recommend I personally have chosen the Visual Paradigm. Had to try most of the editors available on market, including Visio, yEd, ArgoUML and others and found VP to be the most convenient and well thought-out one. Tagged values are supported as well as most of the UML 2.4 (and probably 2.5) notation as far as I can see. There is a Community Edition version available which is free and offers most of the features needed for modeling (codegen and reverse engineering are paid features though). It also has plenty of tutorials and pretty comprehensible help to get things rolling quickly. Diagrams look nice too.