本文整理汇总了C#中ServiceProvider.GetProviderDefaultSettings方法的典型用法代码示例。如果您正苦于以下问题:C# ServiceProvider.GetProviderDefaultSettings方法的具体用法?C# ServiceProvider.GetProviderDefaultSettings怎么用?C# ServiceProvider.GetProviderDefaultSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceProvider
的用法示例。
在下文中一共展示了ServiceProvider.GetProviderDefaultSettings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddService
public static int AddService(ServiceInfo service)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsAdmin
| DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
TaskManager.StartTask("SERVER", "ADD_SERVICE");
TaskManager.ItemId = service.ServerId;
TaskManager.ItemName = GetServerByIdInternal(service.ServerId).ServerName;
TaskManager.WriteParameter("Service name", service.ServiceName);
TaskManager.WriteParameter("Provider", service.ProviderId);
int serviceId = DataProvider.AddService(service.ServerId, service.ProviderId, service.ServiceName,
service.ServiceQuotaValue, service.ClusterId, service.Comments);
// read service default settings
try
{
// load original settings
StringDictionary origSettings = GetServiceSettingsAdmin(serviceId);
// load provider settings
ServiceProvider svc = new ServiceProvider();
ServiceProviderProxy.Init(svc, serviceId);
SettingPair[] settings = svc.GetProviderDefaultSettings();
if (settings != null && settings.Length > 0)
{
// merge settings
foreach (SettingPair pair in settings)
origSettings[pair.Name] = pair.Value;
// update settings in the meta base
string[] bareSettings = new string[origSettings.Count];
int i = 0;
foreach (string key in origSettings.Keys)
bareSettings[i++] = key + "=" + origSettings[key];
UpdateServiceSettings(serviceId, bareSettings);
}
}
catch (Exception ex)
{
TaskManager.WriteError(ex, "Error reading default provider settings");
}
TaskManager.CompleteTask();
return serviceId;
}