示例#1
0
        /// <summary>
        /// Class constructor
        /// </summary>
        static ContextServiceClaimsProvider()
        {
            using (new Tracer())
            {
                try
                {
                    _contextEngineClient = new ODataContextEngine();

                    // The 8.5 Context Service can not handle Publication ID "evidence" if it has not been configured with a reference to CD Data Store (see CRQ-3440).
                    // To avoid issues with a 8.5 Context Service without this configuration, we only include the Publication ID evidence if explicitly configured.
                    // The Context Expression Module installer will configure this.
                    string contextServicePublicationEvidenceSetting = WebConfigurationManager.AppSettings["context-service-publication-evidence"];
                    Log.Debug("context-service-publication-evidence setting: '{0}'", contextServicePublicationEvidenceSetting);

                    if (!string.IsNullOrEmpty(contextServicePublicationEvidenceSetting))
                    {
                        _usePublicationEvidence = Convert.ToBoolean(contextServicePublicationEvidenceSetting);
                    }
                }
                catch (Exception ex)
                {
                    // ODataContextEngine construction can fail for several reasons, because it immediately tries to communicate with Discovery Service.
                    // Error handling in ODataContextEngine is currently suboptimal and class ContextServiceClaimsProvider is constructed very early in the DXA initialization.
                    // Therefore, we just log the error here and continue; GetContextClaims will throw an exception later on (if we even get to that point).
                    Log.Error(ex);
                }
            }
        }
        /// <summary>
        /// Class constructor
        /// </summary>
        static ContextServiceClaimsProvider()
        {
            using (new Tracer())
            {
                try
                {
                    _contextEngineClient = new ODataContextEngine();

                    // The 8.5 Context Service can not handle Publication ID "evidence" if it has not been configured with a reference to CD Data Store (see CRQ-3440).
                    // To avoid issues with a 8.5 Context Service without this configuration, we only include the Publication ID evidence if explicitly configured.
                    // The Context Expression Module installer will configure this.
                    string contextServicePublicationEvidenceSetting = WebConfigurationManager.AppSettings["context-service-publication-evidence"];
                    Log.Debug("context-service-publication-evidence setting: '{0}'", contextServicePublicationEvidenceSetting);

                    if (!string.IsNullOrEmpty(contextServicePublicationEvidenceSetting))
                    {
                        _usePublicationEvidence = Convert.ToBoolean(contextServicePublicationEvidenceSetting);
                    }
                }
                catch (Exception ex)
                {
                    // ODataContextEngine construction can fail for several reasons, because it immediately tries to communicate with Discovery Service.
                    // Error handling in ODataContextEngine is currently suboptimal and class ContextServiceClaimsProvider is constructed very early in the DXA initialization.
                    // Therefore, we just log the error here and continue; GetContextClaims will throw an exception later on (if we even get to that point).
                    Log.Error(ex);
                }
            }
        }
 /// <summary>
 /// Class constructor
 /// </summary>
 static ContextServiceClaimsProvider()
 {
     using (new Tracer())
     {
         try
         {
             _contextEngineClient = new ODataContextEngine();
         }
         catch (Exception ex)
         {
             // ODataContextEngine construction can fail for several reasons, because it immediately tries to communicate with Discovery Service.
             // Error handling in ODataContextEngine is currently suboptimal and class ContextServiceClaimsProvider is constructed very early in the DXA initialization.
             // Therefore, we just log the error here and continue; GetContextClaims will throw an exception later on (if we even get to that point).
             Log.Error(ex);
         }
     }
 }
 /// <summary>
 /// Class constructor
 /// </summary>
 static ContextServiceClaimsProvider()
 {
     using (new Tracer())
     {
         try
         {
             _contextEngineClient = new ODataContextEngine();
         }
         catch (Exception ex)
         {
             // ODataContextEngine construction can fail for several reasons, because it immediately tries to communicate with Discovery Service.
             // Error handling in ODataContextEngine is currently suboptimal and class ContextServiceClaimsProvider is constructed very early in the DXA initialization.
             // Therefore, we just log the error here and continue; GetContextClaims will throw an exception later on (if we even get to that point).
             Log.Error(ex);
         }
     }
 }