本文整理汇总了C#中IOrganizationService.Save方法的典型用法代码示例。如果您正苦于以下问题:C# IOrganizationService.Save方法的具体用法?C# IOrganizationService.Save怎么用?C# IOrganizationService.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOrganizationService
的用法示例。
在下文中一共展示了IOrganizationService.Save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformUpdates
private void PerformUpdates(IOrganizationService service, OrganizationRequestCollection requests)
{
if (SupportsExecuteMultipleRequest)
{
var response = (ExecuteMultipleResponse)service.Execute(
new ExecuteMultipleRequest
{
Settings = new ExecuteMultipleSettings
{
ContinueOnError = false,
ReturnResponses = false
},
Requests = requests
});
if (response.IsFaulted)
{
var fault = response.Responses.First().Fault;
while (fault.InnerFault != null)
{
fault = fault.InnerFault;
}
var errorDetails = string.Empty;
if (fault.ErrorDetails.ContainsKey("CallStack"))
{
errorDetails = Environment.NewLine + fault.ErrorDetails["CallStack"];
}
errorDetails += string.Format("{0}{0}TRACE TEXT:{0}{1}", Environment.NewLine, fault.TraceText);
throw new Exception(fault.Message + errorDetails);
}
}
else
{
foreach (var request in requests)
{
service.Save(((UpdateRequest)request).Target);
}
}
}