3

構成可能な値をSSOに保存し、実行時にカスタムパイプラインコンポーネントで取得する必要があります

これに関する助け...

4

2 に答える 2

3

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);
    }
}

(参考になる場合は、リンクされた投稿にも賛成票を投じてください)

于 2012-07-31T17:48:28.943 に答える
1

次のリンクにアクセスできます。必要な情報がすべて含まれています。

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

于 2012-08-06T16:14:00.203 に答える