本文整理汇总了C#中System.Data.DataRow.LogContentError方法的典型用法代码示例。如果您正苦于以下问题:C# DataRow.LogContentError方法的具体用法?C# DataRow.LogContentError怎么用?C# DataRow.LogContentError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.DataRow
的用法示例。
在下文中一共展示了DataRow.LogContentError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoContentAdd
protected void DoContentAdd(DataRow row, ContentData content, short timeouts = 0, bool failOnFault = false)
{
try
{
if (HasAuthentication)
{
DoAPIAddCall(content);
row.LogContentInfo("saved successfully with id {0}.", content.Id);
}
else
{
row.LogContentWarn("does not have authentication.");
}
}
catch (TimeoutException te)
{
if (timeouts < 10)
{
row.LogContentInfo("save timed out. Trying again.");
Thread.Sleep(TimeoutWait);
DoContentAdd(row, content, ++timeouts);
}
else
{
row.LogContentError("failed to save.", te);
}
}
catch (FaultException fe)
{
if (!failOnFault
&& fe.Message.Contains("The current user does not have permission to carry out this request"))
{
row.LogContentWarn("had authentication error. Re-authenticating then retrying.");
Authenticate();
DoContentAdd(row, content, failOnFault: true);
}
else
{
row.LogContentError("failed to save.", fe);
}
}
catch (CommunicationException ce)
{
if (!failOnFault)
{
row.LogContentWarn("had communication error. Waiting and then retrying.");
Thread.Sleep(TimeoutWait);
DoContentAdd(row, content, failOnFault: true);
}
else
{
LogUpdateError(row, ce);
}
}
catch (Exception ex)
{
row.LogContentError("failed to save.", ex);
}
}
示例2: LogUpdateError
protected static void LogUpdateError(DataRow row, Exception ex)
{
row.LogContentError(
"failed to update with id {0}: {1}",
ex,
row["contentId"],
ex.Message);
}