Hello *,
currently I am desperately trying to design a readonly property in a c# interface. "Readonly" means: The property shall have a getter, but no setter.
A code example would be:
namespace MyNamespace {
public interface MyInterface {
void MyProperty {
get;
}
}//end MyInterface
}//end namespace MyNamespace
How do I do this in EA? This is what I found out:
1.) You can design it as an operation with the "property" stereotype. In this case, I cannot specifiy whether it is readonly or not (by default, a getter and a setter is generated). If create a .cs file, remove the setter manually and synchronize with the model, EA seems to notice it, and when I generate code again (even to another location), no setter is created. So it works! But this is quite complicated and I cannot see in EA whether the property is RO or RW.
2.) I can design it as an attribute and check the "property" checkbox. In this case, I can specify whether it it should have a setter and/or a getter. But then, I have both an attribute and a property (=an operation with "property" stereotype), which is not what I want in an interface. I also cannot delete the attribute afterwards, because then the property is also deleted.
Any ideas on how to create an RO property without hassle? What is the recommended way?
Thanks in advance.
Egon Schneider