本文整理汇总了C#中IEnvironment.CreateSubstitutionParameters方法的典型用法代码示例。如果您正苦于以下问题:C# IEnvironment.CreateSubstitutionParameters方法的具体用法?C# IEnvironment.CreateSubstitutionParameters怎么用?C# IEnvironment.CreateSubstitutionParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEnvironment
的用法示例。
在下文中一共展示了IEnvironment.CreateSubstitutionParameters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnsureSubstitutionParameter
private void EnsureSubstitutionParameter(IEnvironment env, string name, string val)
{
var param = env.SubstitutionParameters.SingleOrDefault(p => p.Name == name);
if (param.IsNull())
{
param = env.CreateSubstitutionParameters(Repository, name);
}
if (!param.Value.Equals(val, StringComparison.InvariantCultureIgnoreCase))
param.ItemValue = val;
Repository.SaveChanges();
}
示例2: EnsureSubstitutionParameters
private static void EnsureSubstitutionParameters(ConfigurationContext context, IEnvironment env)
{
foreach (var serviceHostSettingse in env.ConfigSet.ServiceHosts)
{
foreach (var serviceHostParameter in from p in serviceHostSettingse.Parameters where p.IsEnvironmental select p)
{
if (
env.SubstitutionParameters.All(
s => s.Name != string.Format("{0}_{1}", serviceHostSettingse.Name, serviceHostParameter.Name)))
{
env.CreateSubstitutionParameters(
context,
string.Format("{0}_{1}", serviceHostSettingse.Name, serviceHostParameter.Name));
context.SaveChanges();
}
}
}
}
示例3: UpdateOtherSettings
private void UpdateOtherSettings(FederationSettings registration, IEnvironment env)
{
foreach (var serviceHostSettings in registration.OtherSettings)
{
var serviceHost = env.ConfigSet.ServiceHosts.SingleOrDefault(sh => sh.Name == serviceHostSettings.Key);
foreach (var item in serviceHostSettings.Value)
{
var shParam = serviceHost.Parameters.SingleOrDefault(p => p.Name == item.Key);
if (shParam.IsNull()) shParam = serviceHost.CreateParameter(Repository, item.Key, false, true);
if (shParam.Value != item.Value) shParam.ItemValue = "{0}";
var envParam = env.SubstitutionParameters.SingleOrDefault(p => p.Name == string.Format("{0}_{1}", serviceHost.Name, shParam.Name));
if (envParam.IsNull())
envParam = env.CreateSubstitutionParameters(Repository, string.Format("{0}_{1}", serviceHost.Name, shParam.Name));
if (envParam.Value != item.Value) envParam.ItemValue = item.Value;
Repository.SaveChanges();
}
}
}