Selecting types from a different data contract diagram in v3

Oct 9, 2007 at 8:47 PM
Hi,
I might be missing something simple, but how would you make data contracts from one diagram appear in another diagram's type selector. Some data contracts might be reused between multiple projects therefore I need to have multiple data contract diagrams in the model project each mapped to a specific project in the implementation. Now I need to have an element in one diagram's data contract to be the type of data contract from another diagram. I click type selector, but it only shows types from mscorlib and I have empty <Current Project>.
Thanks,
Alex K.
Oct 10, 2007 at 11:21 PM
In version 2 of the Service Factory when creating translation classes same type selector dialog comes up. It does display every type that is referenced by the project, so I’ve tried to modify the *.ssfproduct file, but it did not help (I probably used incorrect syntax). The type selector is still empty. Are there any plans to add references to the modal project? It would really help when in your data contract you need to reference a previously created type, i.e. already existing data contract.
Developer
Dec 7, 2007 at 6:36 PM
The type selector is only for primitive types, not for DCs.
And on the other hand, you can't reference DCs that lives in another model.
Dec 10, 2007 at 3:04 PM
I might be wrong but it seems to be a critical feature. If you consider data contracts to be reusable components in the enterprise then it is important to allow previously built data contracts to be selected in the model as well as data contracts from other diagrams. As a work around I basically have to modify XML file manually, which is not a big deal, although fixing the using statement after code generation is kind of annoying.
Alex K.
Developer
Dec 10, 2007 at 4:13 PM
Perhaps I'm missing something but according to your description above, I don't get clearly why you need to modify the XML file manually and what kind of fix you need in a using statement.

Thanks,
CF
Dec 11, 2007 at 4:26 PM
Here is an example:
You are working on a service that needs to add a new Manager record to the database. So you create a model project and add data contract called Manager. Now prior to that you worked on a different project where you defined another data contract called EmployeeCompensation, which should be part of the Manager. Ideally you should be able to add a reference to the EmployeeCompensation.dll in the target project and it shows up in the type selector. Instead you have to open data contract xml file, find member name = “employeeCompensation” and modify type attribute (type = “EmployeeCompensation”).
And it works fine unless your EmployeeCompensation happened to be in a different namespace. Then you just have to import a namespace in the target file every time it generates or use a fully qualified name in the type attribute.
May 16, 2008 at 12:52 PM
Edited May 16, 2008 at 1:02 PM
-
Developer
May 19, 2008 at 1:27 PM
zmeyp,

That happend because the model was not designed for referencing external types and since you are adding one by updating the xml file, then code gen won't know how to deal with this type and therefore will not update the namespace (or using statement).
In this case, you can update the tt file (text template) with that namespace or you may go and try to make some changes in code gen (though this option is far more involved then the tt update).