Exemplo n.º 1
0
        protected override void SetEndpointContextProperties(IBaseMessageContext pipelineContext, string endpointConfig)
        {
            //base.SetEndpointContextProperties(pipelineContext, endpointConfig);

            //string[] properties = endpointConfig.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);

            //foreach (string property in properties)
            //{
            //    string[] data = property.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
            //    string key = data[0];
            //    string value = data.Length < 2 ? "" : data[1];

            //    pipelineContext.Write(key, this.AdapterContextPropertyNamespace, value);
            //}

            if (!string.IsNullOrEmpty(endpointConfig))
            {
                AdapterMgr.SetContextProperties(pipelineContext, endpointConfig, this.AdapterName, this.AdapterContextPropertyNamespace);
            }
            else
            {
                string defaultEC = this.GetDefaultEndpointConfig();
                if (!string.IsNullOrEmpty(defaultEC))
                {
                    AdapterMgr.SetContextProperties(pipelineContext, defaultEC, this.AdapterName, this.AdapterContextPropertyNamespace);
                }
            }
        }
        protected override void SetEndpointContextProperties(IBaseMessageContext pipelineContext, string endpointConfig)
        {
            // If not using Adapter Mgr
            // base.SetEndpointContextProperties(pipelineContext, endpointConfig);

            //string[] properties = endpointConfig.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);

            //foreach (string property in properties)
            //{
            //    string[] data = property.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
            //    string key = data[0];
            //    string value = data.Length < 2 ? "" : data[1];

            //    pipelineContext.Write(key, this.AdapterContextPropertyNamespace, value);
            //}

            try
            {
                //Using the Adapter Mgr
                if (!string.IsNullOrEmpty(endpointConfig))
                {
                    AdapterMgr.SetContextProperties(pipelineContext, endpointConfig, this.AdapterName,
                                                    this.AdapterContextPropertyNamespace);
                }
                else
                {
                    string defaultEC = this.GetDefaultEndpointConfig();
                    if (!string.IsNullOrEmpty(defaultEC))
                    {
                        AdapterMgr.SetContextProperties(pipelineContext, defaultEC, this.AdapterName,
                                                        this.AdapterContextPropertyNamespace);
                    }
                }
            }
            catch (Exception ex)
            {
                EventLogger.Write("Windows SharePoint Services::SetEndpointContextProperties threw an exception\n{0}",
                                  ex.ToString());
            }
        }