本文整理汇总了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();
}
示例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));
}
}