What is the proper way to document a C# Attribute on a class in a UML class diagram?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
I don't know if this is "standard", except that it uses a standard feature from UML:
Sparx Enterprise Architect, when reverse-engineering, for instance, a unit test class, uses tagged values for the attributes. A tagged value "
Attribute
" on the class, has the name of the attribute as a value, for instance, "[TestClass]
". Similarly, "Attribute = [TestMethod]
" is placed on the methods. An example would be:In this example,
[TestClass]
and[TestMethod]
are .NET attributes (not UML attributes). They are short for[TestClassAttribute]
and[TestMethodAttribute]
. Both are classes deriving from theSystem.Attribute
class.An attribute simply adds metadata to the assembly. By itself, it has no runtime behavior.
I haven't decided if this is my answer, but I figured I'd throw it out there for sake of discussion. Does this look acceptable?
Its an instance of the attribute type with the metadata values put into tagged values below. I just figured out how to add custom stereo types. The arrow is just a dependency arrow that is labeled as "applies".