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


C# Publisher.PublishAsync方法代码示例

本文整理汇总了C#中Publisher.PublishAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Publisher.PublishAsync方法的具体用法?C# Publisher.PublishAsync怎么用?C# Publisher.PublishAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Publisher的用法示例。


在下文中一共展示了Publisher.PublishAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PublishOneItem

        /// <summary>
        /// </summary>
        /// <param name="item">
        /// </param>
        private static void PublishOneItem(Item item)
        {
            Language lang = Sitecore.Context.Language;
              Database masterDb = Factory.GetDatabase("master");
              Database webDB = Factory.GetDatabase("web");
              var opt = new PublishOptions(masterDb, webDB, PublishMode.SingleItem, lang, DateTime.Now);
              opt.RootItem = item;
              opt.Deep = true;
              var pb = new Publisher(opt);

              pb.PublishAsync();
        }
开发者ID:JimmieOverby,项目名称:SES-example-pages,代码行数:16,代码来源:NicamHelper.cs

示例2: PublishGoogleProductFeedXMLItem

        /// <summary>
        /// Publish Google Product Feed XML Item
        /// </summary>
        /// <param name="item"></param>
        /// <param name="isPublishAsync"></param>
        public static void PublishGoogleProductFeedXMLItem(Item googleProductFeedXMLItem, Database masterDb, bool isPublishAsync, Database TargetDb)
        {
            try
            {
                PublishOptions publishOptions = new PublishOptions(masterDb,
                                                                   TargetDb,
                                                                   Sitecore.Publishing.PublishMode.SingleItem,
                                                                   googleProductFeedXMLItem.Language,
                                                                   System.DateTime.Now);

                Publisher publisher = new Publisher(publishOptions);
                publisher.Options.RootItem = googleProductFeedXMLItem;
                publisher.Options.Deep = false;

                if (isPublishAsync)
                    publisher.PublishAsync();
                else
                    publisher.Publish();
            }
            catch (Exception ex)
            {
                Log.Error("Error in PublishGoogleProductFeedXMLItem(). Item ID: " + googleProductFeedXMLItem.ID, ex, typeof(GoogleProductFeedCreation));
            }
        }
开发者ID:nikkipunjabi,项目名称:GoogleProductFeed,代码行数:29,代码来源:GoogleProductFeedCreation.cs


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