kkocabiyik
kkocabiyik

Reputation: 4406

Updating Existing Class From UML Diagram in Visual Studio

I have created a UML diagram and generated a class by using Generate Code feature of Visual Studio Feature Pack 2. I have implemented the methods in that class. When I want add a new method into class from uml diagram and use generate code feature, it remove all implementations in methods but add my newly added method from uml diagram. It acts like removing the existing class and creating it again. How can i update it without removing whole class and just add a method?

Upvotes: 0

Views: 320

Answers (1)

Derreck Dean
Derreck Dean

Reputation: 3766

Use partial classes.

The classes that are generated should have partial before them, e.g. public partial class Foo : Bar; create a new file (file name or location does not matter). The namespace and the class name must be the same as the auto-generated one, and it must include partial. The definitions from all the files are combined into a single class, and you don't have to worry about the auto-generated code deleting your extra file.

Upvotes: 2

Related Questions