Biztalk 在SSO中存储可配置值
我需要在SSO中存储可配置的值,并在运行时在自定义管道组件中检索它们Biztalk 在SSO中存储可配置值,biztalk,single-sign-on,biztalk-2010,custom-pipeline-component,Biztalk,Single Sign On,Biztalk 2010,Custom Pipeline Component,我需要在SSO中存储可配置的值,并在运行时在自定义管道组件中检索它们 有关此…的任何帮助有关在SSO中存储值的帮助,请参阅 只要在管道组件中检索它们,就可以创建一个助手函数。类似这样的方法会奏效: using System; using System.Collections; using System.Collections.Specialized; using Microsoft.BizTalk.SSOClient.Interop; /// <summary> /// Conta
有关此…的任何帮助有关在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);
}
}
使用系统;
使用系统集合;
使用System.Collections.Specialized;
使用Microsoft.BizTalk.SSOClient.Interop;
///
///包含将SSO用作配置存储的帮助器方法。
///
公共静态类SSOConfigHelper
{
///
///可以设置为任何值
///
私有静态字符串idenifierGUID=“ConfigProperties”;
///
///Read方法有助于获取配置数据
///
///表示要访问的配置容器的附属应用程序的名称
///要读取的属性名
///
///存储在此组件的给定附属应用程序中的属性值。
///
公共静态字符串读取(字符串appName、字符串propName)
{
尝试
{
SSOConfigStore SSOSStore=新SSOConfigStore();
ConfigurationPropertyBag appMgmtBag=新的ConfigurationPropertyBag();
(ISSOConfigStore)ssoStore).GetConfigInfo(appName,idenifierGUID,SSOFlag.SSO_FLAG_RUNTIME,(IPropertyBag)appMgmtBag);
对象propertyValue=null;
appMgmtBag.Read(propName,out propertyValue,0);
返回(字符串)propertyValue;
}
捕获(例外e)
{
系统.诊断.跟踪.写入线(e.Message);
投掷;
}
}
}
//上面的代码使用这个propertybag
公共类配置PropertyBag:IPropertyBag
{
///
///属性
///
私有杂交字典属性;
///
///初始化ConfigurationPropertyBag类的新实例
///
内部配置PropertyBag()
{
this.properties=新的HybridDictionary();
}
#区域IPropertyBag成员
///
///实现IPropertyBag读取
///
///IPropertyBag propName
///IPropertyBag ptrVar
///IPropertyBag错误日志
公共无效读取(字符串propName、out对象ptrVar、int errorLog)
{
ptrVar=this.properties[propName];
}
///
///实现IPropertyBag写入
///
///IPropertyBag propName
///IPropertyBag ptrVar
public void Write(字符串propName,ref object ptrVar)
{
this.properties.Add(propName,ptrVar);
}
#端区
///
///搜索属性键
///
///kv对钥匙
///如果找到密钥,则为true
公共bool包含(字符串键)
{
返回this.properties.Contains(键);
}
///
///删除属性
///
///kv对钥匙
公共无效删除(字符串键)
{
此.properties.Remove(键);
}
}
(如果链接帖子对你有帮助,请向上投票)你可以转到以下链接。它包含了你需要的所有信息
谢谢你提供的信息。我将开始处理它。我无法更新它,因为它需要15个声誉。但我以后一定会更新它。你能帮助我如何在自定义管道组件中写入sso吗?你尝试过什么吗?像BizTalk管道组件向导一样?