当前位置: 首页>>代码示例>>C#>>正文


C# DataRow.LogContentError方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:benjaminramey,项目名称:GoodlyFere.Import.Plugins,代码行数:59,代码来源:DestinationBase.cs

示例2: LogUpdateError

 protected static void LogUpdateError(DataRow row, Exception ex)
 {
     row.LogContentError(
         "failed to update with id {0}: {1}",
         ex,
         row["contentId"],
         ex.Message);
 }
开发者ID:benjaminramey,项目名称:GoodlyFere.Import.Plugins,代码行数:8,代码来源:DestinationBase.cs


注:本文中的System.Data.DataRow.LogContentError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。