EventSubscripton'dan Eventing Code'umuzdaki Abonelikten çıkmaya çalışıyoruz. Biz eventing çalışması gerekiyordu edildiği müteakip olaylar çalışmamaya başlıyor,SDL Tridion EventSubscription Abonelikten Çıkma Sorun
[TcmExtension("EventHandlerExtension")]
public class EventHandler : TcmExtension, IDisposable
{
private EventSubscription componentSaveSubscription = null;
private EventSubscription componentPublishSubscription = null;
#region Public Methods
/// <summary>
/// Handle for Eventing System
/// </summary>
public EventHandler()
{
Subscribe();
}
/// <summary>
/// Subscribe Events
/// </summary>
public void Subscribe()
{
//News Article Page created when component Save
componentSaveSubscription = EventSystem.Subscribe<Component, SaveEventArgs>(OnComponentSavePost, EventPhases.TransactionCommitted);
//EventSystem.Subscribe<Component, SaveEventArgs>(OnComponentSavePost, EventPhases.TransactionCommitted);
componentPublishSubscription = EventSystem.Subscribe<Component, PublishOrUnPublishEventArgs>(OnComponentPublishOrUnPublishPost, EventPhases.TransactionCommitted);
//EventSystem.Subscribe<StructureGroup, PublishOrUnPublishEventArgs>(OnStructureGroupPublishInitiated, EventPhases.TransactionCommitted);
}
/// <summary>
/// IDisposable Implementation
/// </summary>
public void Dispose()
{
if (componentSaveSubscription != null) componentSaveSubscription.Unsubscribe();
if (componentPublishSubscription != null) componentPublishSubscription.Unsubscribe();
}}
Ne gözlemledim o zamanlar “{EventSubsciption} .Unsubscribe” denir olduğu aşağıdaki kodu kullanıyor. Etkinlik sistemi ile ilgili hizmetler yeniden başlatıldıktan sonra, etkinlik kodu ilk kez beklendiği gibi çalışır ve sonraki olaylar için (bunun çalışması gereken) asla çağrılmaz.
ne zaman nesne en 'Dispose()' yöntemi çağrılır edilir:
Benim Demirbaş Handler şöyle? Bildiğim kadarıyla bunun yalnızca işleyicinin çalıştırdığı modül kapatıldığında (ve potansiyel olarak o zaman bile değil) gerçekleşmesi gerekiyor. –
Ve eğer Dispose() yoksa, beklendiği gibi çalışır? O zaman atmayı bırak? –