public static void AttachObjectExtender(IExtensibleObject extensibleObject, Extension.IExtensionProvider extensionProvider) { Guard.ArgumentNotNull(extensibleObject, "extensibleObject"); Guard.ArgumentNotNull(extensionProvider, "extensionProvider"); ExtensionProviderHelper extensionProviderHelper = new ExtensionProviderHelper(extensibleObject); object extender = extensionProviderHelper.CreateObjectExtender(extensionProvider, extensibleObject as ModelElement); extensionProviderHelper.SetObjectExtender(extender); }
private static void ProvideObjectExtender(ModelElement mel, IExtensibleObject extensibleObject, IExtensionProvider extensionProvider) { ExtensionProviderHelper extensionProviderHelper = new ExtensionProviderHelper(extensibleObject); if (extensibleObject.ObjectExtenderContainer == null) { extensionProviderHelper.CreateObjectExtenderContainer(); object extender = extensionProviderHelper.CreateObjectExtender(extensionProvider, mel); extensionProviderHelper.SetObjectExtender(extender); } else { if (extensionProviderHelper.GetObjectExtender(extensionProvider) == null) { object extender = extensionProviderHelper.CreateObjectExtender(extensionProvider, mel); extensionProviderHelper.SetObjectExtender(extender); } else { //Redirect object extender extensionProviderHelper.SetObjectExtender(extensionProviderHelper.GetObjectExtender(extensionProvider)); } } }