private bool RegisterChangeNotification(IConfigurationSession session, CacheNotificationHandler cacheNotificationHandler, bool throwExceptions) { if (!OrganizationId.ForestWideOrgId.Equals(this.organizationId)) { return(true); } try { this.notificationCookie = ADNotificationAdapter.RegisterChangeNotification <TConfig>(this.organizationId.ConfigurationUnit ?? session.GetOrgContainerId(), new ADNotificationCallback(TenantConfigurationCacheableItem <TConfig> .HandleChangeNotification), new CacheNotificationArgs(cacheNotificationHandler, this.organizationId)); } catch (TransientException) { if (!throwExceptions) { return(false); } throw; } catch (DataSourceOperationException) { if (!throwExceptions) { return(false); } throw; } return(true); }
public override bool Initialize(OrganizationId organizationId, CacheNotificationHandler cacheNotificationHandler, object state) { IConfigurationSession configurationSession = this.Initialize(organizationId, true); if (configurationSession == null) { return(false); } if (this.InternalRead(configurationSession, true, state) && this.RegisterChangeNotification(configurationSession, cacheNotificationHandler, true)) { this.initialized = true; return(true); } return(false); }
public abstract bool TryInitialize(OrganizationId organizationId, CacheNotificationHandler cacheNotificationHandler, object state);
public CacheNotificationArgs(CacheNotificationHandler cacheNotificationHandler, OrganizationId organizationId) { this.cacheNotificationHandler = cacheNotificationHandler; this.organizationId = organizationId; }