Is there a way to get a reference to Microsoft.VisualStudio.Uml.Profiles.IStereotype interface in a t4 template? I mean IStereotype that stores the definition of the UML stereotype, and not IStereotypeInstance that holds the actual value. I tried something like this, but the ApplicableStereotypes enumereation is empty.
void WriteClassAttributes( IClass classItem )
{
foreach( IStereotypeInstance stereoInst in classItem.AppliedStereotypes )
{
this.WriteLine( string.Format( "{0} = {1}", stereoInst.Profile, stereoInst.Name ) );
}
foreach( IStereotype stereo in classItem.ApplicableStereotypes )
{
this.WriteLine( string.Format( "{0} = {1}", stereo.Profile.Name, stereo.Name ) );
}
}
I tried to get IStereotype from ModelStore. But ProfileManager property always returns null and the code breaks.
string GetDefaultValue( IStereotypePropertyInstance stereoProp )
{
IModelStore modelStore = stereoProp.GetModelStore();
Microsoft.VisualStudio.Uml.Profiles.IProfile profile =
modelStore.ProfileManager.GetProfileByName( profileName );
foreach( IStereotype stereo in profile.Stereotypes )
{
if( stereo.Name == stereoProp.StereotypeInstance.Name )
{
return stereo.DefaultValue;
}
}
}
I'm stucked. Please help!