本文整理汇总了C#中EPiServer.Core.ContentReference.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ContentReference.Equals方法的具体用法?C# ContentReference.Equals怎么用?C# ContentReference.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EPiServer.Core.ContentReference
的用法示例。
在下文中一共展示了ContentReference.Equals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildTrackingScript
public override string BuildTrackingScript(ScriptBuilderContext appenderContext, SiteTrackerSettings siteSettings,
out bool requiresScriptReference)
{
requiresScriptReference = false;
if (siteSettings == null)
{
return null;
}
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine("/* Begin GA Script */");
stringBuilder.AppendLine(_gaScript);
stringBuilder.AppendLine(string.Format("ga('create', '{0}', 'auto');", siteSettings.TrackingId));
stringBuilder.AppendLine("// Extended Tracking");
stringBuilder.AppendLine(AppendExtendedTracking(siteSettings, ref requiresScriptReference));
stringBuilder.AppendLine("// Plugin Script");
stringBuilder.AppendLine(this.GetPluginScript());
if (siteSettings.TrackAuthors && !string.IsNullOrEmpty(appenderContext.Author))
{
stringBuilder.AppendLine("// Custom Author Tracking");
stringBuilder.AppendLine(this.GetCustomDimension("Author", CustomVariables.AuthorVariable, appenderContext.Author));
}
ContentReference contentReference = new ContentReference(appenderContext.PageId);
ICollection<AnalyticsInteraction> interactions = EPiServer.GoogleAnalytics.Helpers.Extensions.GetInteractions(appenderContext.InteractionStore);
// This is where the interesting stuff happens
// All custom interactions are added here
stringBuilder.AppendLine("// Begin Interactions");
foreach (AnalyticsInteraction interaction in interactions)
{
// Skip any interactions that are tied to a specific page
if (ContentReference.IsNullOrEmpty(interaction.ContentLink) == false &&
contentReference.Equals(interaction.ContentLink) == false)
{
continue;
}
stringBuilder.AppendLine(interaction.GetUAScript());
}
stringBuilder.AppendLine("// End Interactions");
// Clear any interactions that should not persist
// across a request
this.ClearRedundantInteractions(interactions);
stringBuilder.AppendLine("ga('send', 'pageview');");
stringBuilder.AppendLine("/* End GA Script */");
return stringBuilder.ToString();
}
示例2: Equals_IfTheObjectParameterIsTheSameInstance_ShouldReturnTrue
public void Equals_IfTheObjectParameterIsTheSameInstance_ShouldReturnTrue()
{
ContentReference contentReference = new ContentReference();
// ReSharper disable EqualExpressionComparison
Assert.IsTrue(contentReference.Equals(contentReference));
// ReSharper restore EqualExpressionComparison
}
开发者ID:HansKindberg-Net,项目名称:HansKindberg-EPiServer-CMS7-Abstractions,代码行数:7,代码来源:ContentReferenceTest.cs
示例3: Equals_IfTheParameterIsAPageReferenceAndThePropertiesAreEqual_ShouldReturnTrue
public void Equals_IfTheParameterIsAPageReferenceAndThePropertiesAreEqual_ShouldReturnTrue()
{
PageReference pageReference = new PageReference(DateTime.Now.Millisecond, DateTime.Now.Second, DateTime.Now.Second%2 == 0 ? "Test" : null);
ContentReference contentReference = new ContentReference(pageReference.ID, pageReference.WorkID, pageReference.RemoteSite);
// ReSharper disable SuspiciousTypeConversion.Global
Assert.IsTrue(contentReference.Equals(pageReference));
// ReSharper restore SuspiciousTypeConversion.Global
}
开发者ID:HansKindberg-Net,项目名称:HansKindberg-EPiServer-CMS7-Abstractions,代码行数:9,代码来源:ContentReferenceTest.cs