/// <summary> /// 应用扩展项目 /// </summary> /// <param name="opertion">模型对象</param> /// <param name="ProfileName"></param> /// <param name="StereotypeName"></param> private void ApplyStereotype(IElement opertion, string ProfileName, string StereotypeName) { var q = opertion.GetModelStore().ProfileManager.AllProfiles.ToList(); foreach (IProfile ip in q) { if (ip.Name == ProfileName) { foreach (IStereotype istype in ip.Stereotypes) { if (istype.Name == StereotypeName && opertion.ApplicableStereotypes.ToList().Contains(istype)) { var stereotypeInstaces = opertion.AppliedStereotypes.ToList(); int count = 0; foreach (IStereotypeInstance isInstance in stereotypeInstaces) { if (isInstance.Name == istype.Name) { count = count + 1; break; } } if (count == 0) { opertion.ApplyStereotype(istype); } } } } } }