Author Topic: Support of C# 3.x automatic properties  (Read 1922 times)

José

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Support of C# 3.x automatic properties
« on: May 20, 2008, 07:00:06 pm »
We have started using C# automatic properties and have seen that when we use the reverse engineering option, the link between classes are not shown in class diagram. This works ok if we use members instead of the automatic properties.

e.g:
public class A {}
public class B
{
public B TheB {get; set;}  // auto property
}

--> dropping A and B on a class diagram will not show any relation between the 2 classes. The relation has to be added manually.

Is there any plan to add support for this new C# /.NET feature?

thanks,
José

Jeff Odell

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: Support of C# 3.x automatic properties
« Reply #1 on: March 06, 2010, 12:56:53 am »
This is still the case in 8.0 beta.  I put in a bug report to see if this can be repaired.

MarcioMonego

  • EA Novice
  • *
  • Posts: 10
  • Karma: +1/-0
    • View Profile
Re: Support of C# 3.x automatic properties
« Reply #2 on: March 24, 2016, 06:43:29 am »
I know it's a very old post but since Sparx didn't answer our very valuable question here is a workaround for reverse engineering and see the C# auto-implemented properties showing as class associations.

First of all this method is intend to help on just reverse engineering to facilitate the comprehension of large models AND NOT for bidirectional code engineering.

The key for the problem is the absence of an auto generated backing field for the C# compiler to represent the true UML association that cannot be represented based on methods. Just UML attributes.

Then isted of making reverse engineering based on source code files (.cs or what ever) make reverse engineering base on .Net binaries with Disassembly method (You be prompted to show the path to Peverify.exe, found on Microsoft SDKs). This way the assembly WILL contain the auto generated backing fields necessary to show the correct UML association.

Disadvantages:
You cannot show source code on any element as all will be fixed to file.dll/exe used on reverse engineer;
You cannot edit this reverse engineered elements to synchronize with original code if you have it;
You will see all anonymous types your code have;

But anyway it is still useful.

Hope it can help some of you!

Márcio Mônego