/// <summary>
        /// Pushes CrmSubscriptionMessages into the cache
        /// </summary>
        /// <param name="crmSubscriptionMessage">Message to push into the cache</param>
        /// <param name="isSearchIndexInvalidationMessage">Whther to update message from search subscription</param>
        // TODO perf might require us to keep a table in memory for lookup and access cache only to insert
        internal void UpdateNotificationMessageTable(ICrmSubscriptionMessage crmSubscriptionMessage, bool isSearchIndexInvalidationMessage = false)
        {
            if (crmSubscriptionMessage is MetadataMessage)
            {
                //When New Views are added which is a metadata change we Refresh Search Index Enabled entity List
                WebAppConfigurationProvider.GetPortalEntityList();
                ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Found a MetaData Change {0} in messageId: {1}.", crmSubscriptionMessage.MessageName, crmSubscriptionMessage.MessageId));
                lock (metadataFlagLock)
                {
                    this.MetadataDirtyEntry = true;
                }
                return;
            }
            EntityRecordMessage message = crmSubscriptionMessage as EntityRecordMessage;

            portalUsedEntities = WebAppConfigurationProvider.PortalUsedEntities;

            //Filter's out Entities Not Used in Portal
            if (message != null && portalUsedEntities.ContainsKey(message.EntityName))
            {
                ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Pushing MessageId: {0} CRMSubscriptionMessage with entity: {1} and message name: {2} into the Cache.", message.MessageId, message.EntityName, message.MessageName));
                var entityKey = string.Format(EntityKey, message.EntityName,
                                              isSearchIndexInvalidationMessage ? FromSearchSubscription : FromCacheSubscription);
                if (!this.DirtyTable.TryAdd(entityKey, new EntityInvalidationMessageAndType(message, isSearchIndexInvalidationMessage)))
                {
                    EntityInvalidationMessageAndType val = null;
                    var success = this.DirtyTable.TryGetValue(message.EntityName, out val);
                    ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Dirty Table already contains entity: {0} and message name: {1} in the Cache with MessageId: {2}. Dropping MessageId: {3} ", message.EntityName, message.MessageName, success ? val.Message.MessageId : Guid.Empty, message.MessageId));
                }
            }
        }
Exemplo n.º 2
0
 public static bool GetTimeTrackingTelemetryString()
 {
     return(WebAppConfigurationProvider.GetAppSetting <bool>(Constants.TimeTrackingTelemetry));
 }