存储在SSO配置值(Store configurable values in SSO)

2019-09-20 13:10发布

我需要配置的值存储在SSO,并在运行时,在自定义管道组件进行检索

对于任何帮助,这...

Answer 1:

你可以去以下links..it有你需要的所有信息

http://social.technet.microsoft.com/wiki/contents/articles/6494.biztalk-server-application-configuration-options.aspx



Answer 2:

如需帮助存储在SSO值,请参阅这篇文章 。

至于在管道组件检索它们,您可以创建一个辅助功能。 像这样将工作:

using System;
using System.Collections;
using System.Collections.Specialized;
using Microsoft.BizTalk.SSOClient.Interop;

/// <summary>
/// Contains helper methods for using SSO as a config store.
/// </summary>
public static class SSOConfigHelper
{
    /// <summary>
    /// Can be set to anything
    /// </summary>
    private static string idenifierGUID = "ConfigProperties";

    /// <summary>
    /// Read method helps get configuration data
    /// </summary>        
    /// <param name="appName">The name of the affiliate application to represent the configuration container to access</param>
    /// <param name="propName">The property name to read</param>
    /// <returns>
    /// The value of the property stored in the given affiliate application of this component.
    /// </returns>
    public static string Read(string appName, string propName)
    {
        try
        {
            SSOConfigStore ssoStore = new SSOConfigStore();
            ConfigurationPropertyBag appMgmtBag = new ConfigurationPropertyBag();
            ((ISSOConfigStore)ssoStore).GetConfigInfo(appName, idenifierGUID, SSOFlag.SSO_FLAG_RUNTIME, (IPropertyBag)appMgmtBag);
            object propertyValue = null;
            appMgmtBag.Read(propName, out propertyValue, 0);
            return (string)propertyValue;
        }
        catch (Exception e)
        {
            System.Diagnostics.Trace.WriteLine(e.Message);
            throw;
        }
    }
}

// The code above uses this propertybag
public class ConfigurationPropertyBag : IPropertyBag
{
    /// <summary>
    /// The properties
    /// </summary>
    private HybridDictionary properties;

    /// <summary>
    /// Initializes a new instance of the ConfigurationPropertyBag class
    /// </summary>
    internal ConfigurationPropertyBag()
    {
        this.properties = new HybridDictionary();
    }

    #region IPropertyBag Members
    /// <summary>
    /// Implements IPropertyBag read
    /// </summary>
    /// <param name="propName">IPropertyBag propName</param>
    /// <param name="ptrVar">IPropertyBag ptrVar</param>
    /// <param name="errorLog">IPropertyBag errLog</param>
    public void Read(string propName, out object ptrVar, int errorLog)
    {
        ptrVar = this.properties[propName];
    }

    /// <summary>
    /// Implements IPropertyBag write
    /// </summary>
    /// <param name="propName">IPropertyBag propName</param>
    /// <param name="ptrVar">IPropertyBag ptrVar</param>
    public void Write(string propName, ref object ptrVar)
    {
        this.properties.Add(propName, ptrVar);
    }
    #endregion

    /// <summary>
    /// Searches for property key
    /// </summary>
    /// <param name="key">key of kv pair</param>
    /// <returns>true if key found</returns>
    public bool Contains(string key)
    {
        return this.properties.Contains(key);
    }

    /// <summary>
    /// Removes property
    /// </summary>
    /// <param name="key">key of kv pair</param>
    public void Remove(string key)
    {
        this.properties.Remove(key);
    }
}

(请同时给予好评的链接后,如果它可以帮助你)



文章来源: Store configurable values in SSO