Vs-sde c# .net

I have some questions about using SDE in VS:

  1. Does VS-SDE support .NET generics? I try to write in code:
    public interface ISecurityParticipant
    {
    string Name { get; set;}
    List Test { get;set;}
    }

then update to model diagram and then update to code. and get following:

public interface ISecurityParticipant
{
string Name { get; set;}
System.Collections.Generic.List Test { get;set;}
}

  1. When I try to update diagram from code sometimes association don’t show on the diagram, although relations are created it the diagram object. Why do that happens? How to show the associations lines?

  2. How can I use deriving from .NET framework classes, such as CollectionBase? I didn’t find references to System and other .NET framework namespaces. Does the SDE supports them?

Hello xplicit,

Thank you for your message. For your questions:

  1. I’ve tested with SDE-VS but cannot repeat your problem. Would you mind tell me the version and build number of SDE-VS you are using? You can find the version and build number from the about dialog of SDE-VS.

  2. By default update diagram from code will not generate the association automatically (to avoid generate a too complex diagram). You can right click on the class in diagram and select Related Model > Show Relationships > Association to show them up in diagram.

  3. SDE didn’t bundled the models from .NET Framework. You can include them into your model by using Instant Reverse (Modeling > Instant Reverse > .NET DLL or exe) to reverse the .NET Framework library (dll) for referencing.

If you require any further information, please do not hesitate to contact me again.

Best regards,
Rain Wong

Rian, thank you for the answers.

The version is: 4.2 (Build sp1_20080311)

How to reproduce:


  1. Start Visual Studio

  2. Create new C# project (class library)

  3. Do update from code to model.

  4. In class1.cs insert code:
    interfate ITest
    {
    string Name {get;set;}
    List Test{get;set;}
    }

  5. Do update from code to model

  6. Open class diagram

  7. Place ITest and Class1 on the diagram

  8. Do Update from model to code

and you will get:

interfate ITest
{
string Name {get;set;}
System.Collections.Generic.List Test{get;set;}
}

Am I understand your answer right, that SDE-VS supports .NET generics as well, and I am just receive a bug due my version of the product?

So if I place some generic property in the class, as for my example List Test{get;set;}, at the diagram I will see associations between Class1 and ITest interface?

Also, I have some additional questions:

  1. How to open VS-SDE project? When I start VS-SDE, I see tips at all windows: “please, open the project”. But I did not find any menu items with name “open project”. If I open .NET project, the message still same. I resolve this issue by right clicking on the source code and choosing “update model from code”. But I want to know is there some standart way to create and open new SDE project?
  2. How can I change color of shapes in the diagram without deleting it from diagram?
  3. Can I hide the association from the diagram without deleting relationship?

Hello xplicit,

Thanks for replying. We have tried your steps but still cannot repeat the problem. After update code to model, the list in ITest is showing as

+Test : System.Collections.Generic.List<ClassLibrary12.Class1>

And when update back to code, it keep as

List Test{get;set;}

since the “using System.Collections.Generic;” statement is in source file already. What I tested is a newer build then current release (which should not make any difference). Can you have a try on it and see is it working?

http://files3.visual-paradigm.com/200804/Patch/sp1_20080311zg/VP_Suite_Windows_3_2_sp1_20080311zg.exe

And for the other questions"

  1. You can right click on the project in the Solution Explorer and select Open SDE-VS

  2. You can select the shape, then press the “…” button in the Fill row inside the Property table.

  3. The only way is to delete the relationship. In fact, deleting the line doesn’t means really deleting the relationship. It only delete the view of the relationship but not the underlying model (unless you choose also delete the model).

Looking forward to hear from you.

Best regards,
Rain Wong

Tried version, you’ve posted above. Updating to model and then to code works fine, but I don’t see in the diagram relations between interface ITest and class Class1.

Hello xplicit,

Thanks for replying. I’ve forwarded this issue to our engineers to follow-up and will get back to you shortly.

Best regards,
Rain Wong

I also tried with indexers and get a strange things:

code:

 
    class TestCollection
    {
        string this[int index] {get { return index.ToString(); } }

        string this[string name] { get {return name;}}

    }

I do update to model I see in model only one attribute ‘this’. It is marked as indexer. I delete code inside class and do ‘update to code’. Nothing happens.
Then I do ‘force update to code’ and see

 
    class TestCollection
    {
    private string this[] {
get {
throw new System.Exception("Not implemented");
}
}

    }
}

where are parameters and where is second indexer?

Hello xplicit,

Thanks for the details and our engineers are checking this problem. I’ll let you know once it was fixed. If you need any help, please do not hesitate to contact me again.

Best regards,
Rain Wong

Hello xplicit,

I would like to let you know the indexer problem has been fixed and deployed and you can download the patch build at the following link.

http://files3.visual-paradigm.com/200804/Patch/sp1_20080417c/VP_Suite_Windows_3_2_sp1_20080417c.exe

And about the not showing association issue you reported, this is caused by the current SDE-VS only support array in handling associations. We will support the collection type in out next release (around June). If you need any help, please do not hesitate to contact me again.

Best regards,
Rain Wong

Hello, Rian,

Just found your answer, will try new release soon. Also, I have a question:

I have a Visual Studio solution, which is divided into several projects. When I use update to UML model, classes goes to model diagram for the currently selected project. Then I want to create class diagram for the other project in the same solution, which is used one class from the first project. But when I try to create new diagram, models from the first projects are dissapeared and I could not drag and drop class from model explorer to class diagram. Is it possible to add into class diagram classes from other projects of same solution?

Hi xplicit,

Thanks for your reply. I’m Lilian, a colleague of Rain.

We are sorry that we do not support reusing models across projects at the moment. Alternatively, you can export your projects as SDE projects (.vpp) and then import them into the project containing your main model to get the models in the main project. Details steps are as follow:

  1. set the startup project in Visual Studio (by the Solution Properties)
  2. open SDE-VS
  3. update to UML model
  4. save SDE project and export the SDE project (.vpp)
  5. repeat steps 1-3 until all the projects are exported as SDE project
  6. set the project containing the main model as the startup project
  7. open SDE-VS
  8. import all other SDE-projects

In this way, you will get the models in other projects in one project. But please note if you generate code for the entire main project, it will create codes for the imported models as well (as models from other projects are imported into the main project). You need to filter the imported models by your self when generating code to avoid duplication.

I hope this can help. If there are any inquiries, please feel free to ask.

Best regards,
Lilian Wong