Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: kossmann on March 09, 2004, 01:05:46 pm
-
I forward engineer from EA structs (struct stereotype as opposed to a class). My structs have attributes, and also implement one or more interfaces.
When I reverse engineer a struct such as
internal struct MyStruct : ICompare
{
internal int i1;
internal int i2;
int CompareTo(object obj){
return i1 - ((MyStruct)obj).i1;
}
}
it works fine, but then when I forward engineer that again, the Interface being implemented disappears, ie. the forward engineering produces:
internal struct MyStruct
{
internal int i1;
internal int i2;
int CompareTo(object obj){
return i1 - ((MyStruct)obj).i1;
}
}
Any ideas?
Rainer
-
Hi Rainer,
Thanks for the note.
This is caused by an error in one of the the C# code generation templates.
We will fix this for release of EA 4.0.
As a short term work around, you can override the default C# "ClassInherits" code template for the struct stereotype:
1. Open the Code Template Editor (Ctrl+Shift+P)
2. Select C# as the language
3. Select the ClassInherits template
4. Select the struct stereotype override
5. Replace the line :
$interfaces=%list="ClassInterfaces" @separator=", "%
with
$interfaces=%list="ClassInterface" @separator=", "%
6. Click save
Next time you generate the interface should appear.
I hope this helps.
Regards,
Ben
-
Thanks, Ben. That did the trick.
Rainer