本文整理汇总了C#中N2.Web.PathData类的典型用法代码示例。如果您正苦于以下问题:C# PathData类的具体用法?C# PathData怎么用?C# PathData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PathData类属于N2.Web命名空间,在下文中一共展示了PathData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SetItem
public void SetItem()
{
var path = new PathData(page);
path.CurrentItem.ID.ShouldBe(1);
path.ID.ShouldBe(1);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:7,代码来源:PathDataTests.cs
示例2: Attached_path_values_doesnt_mutate_original
public void Attached_path_values_doesnt_mutate_original()
{
var path = new PathData { Action = "hej", CurrentItem = item, Ignore = true, IsCacheable = true, IsPubliclyAvailable = true, IsRewritable = true, Path = "/x", StopItem = page, TemplateUrl = "/hello.aspx" };
var detached = path.Detach();
var reattached = detached.Attach(persister);
detached.Action = "hejdå";
detached.CurrentItem = page;
detached.Ignore = false;
detached.IsCacheable = false;
detached.IsPubliclyAvailable = false;
detached.IsRewritable = false;
detached.Path = "/y";
detached.StopItem = item;
detached.TemplateUrl = "/world.aspx";
detached.QueryParameters["Hello"] = "world";
reattached.Action.ShouldNotBe("hejdå");
reattached.CurrentItem.ShouldNotBe(page);
reattached.Ignore.ShouldNotBe(false);
reattached.IsCacheable.ShouldNotBe(false);
reattached.IsPubliclyAvailable.ShouldNotBe(false);
reattached.IsRewritable.ShouldNotBe(false);
reattached.Path.ShouldNotBe("/y");
reattached.StopItem.ShouldNotBe(item);
reattached.TemplateUrl.ShouldNotBe("/world.aspx");
reattached.QueryParameters.ContainsKey("Hello").ShouldBe(false);
}
开发者ID:zhaoguoli,项目名称:n2cms,代码行数:29,代码来源:PathDataTests.cs
示例3: InjectCurrentPage
/// <summary>Inject the current page into the page handler.</summary>
/// <param name="handler">The handler executing the request.</param>
public virtual void InjectCurrentPage(PathData path, IHttpHandler handler)
{
IContentTemplate template = handler as IContentTemplate;
if (template != null && path != null)
{
template.CurrentItem = path.CurrentPage;
}
}
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:10,代码来源:RequestAdapter.cs
示例4: RewriteRequest
/// <summary>Rewrites a dynamic/computed url to an actual template url.</summary>
public virtual void RewriteRequest(PathData path, RewriteMethod rewriteMethod)
{
if (path == null || path.IsEmpty() || !path.IsRewritable || path.Ignore || rewriteMethod == RewriteMethod.None)
return;
string templateUrl = GetHandlerPath(path);
WebContext.HttpContext.RewritePath(templateUrl, false);
}
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:9,代码来源:RequestAdapter.cs
示例5: Attach_uses_persister_to_load_page
public void Attach_uses_persister_to_load_page()
{
var path = new PathData { CurrentPage = page };
path = path.Detach();
path.CurrentPage.ShouldBe(null);
var loadedPath = path.Attach(persister);
loadedPath.CurrentPage.ID.ShouldBe(1);
}
开发者ID:zhaoguoli,项目名称:n2cms,代码行数:9,代码来源:PathDataTests.cs
示例6: Attach_creates_cloned_object
public void Attach_creates_cloned_object()
{
var path = new PathData { Action = "hej", CurrentItem = item, Ignore = true, IsCacheable = true, IsPubliclyAvailable = true, IsRewritable = true, Path = "/x", StopItem = page, TemplateUrl = "/hello.aspx" };
var detached = path.Detach();
var reattached = detached.Attach(persister);
reattached.ShouldNotBeSameAs(detached);
}
开发者ID:zhaoguoli,项目名称:n2cms,代码行数:9,代码来源:PathDataTests.cs
示例7: Item_MayBe_null
public void Item_MayBe_null()
{
var path = new PathData();
path.CurrentItem = item;
path.CurrentItem = null;
path.CurrentItem.ShouldBe(null);
path.ID.ShouldBe(0);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:10,代码来源:PathDataTests.cs
示例8: Page_MayBe_null
public void Page_MayBe_null()
{
var path = new PathData();
path.CurrentPage = page;
path.CurrentPage = null;
path.CurrentPage.ShouldBe(null);
path.PageID.ShouldBe(0);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:10,代码来源:PathDataTests.cs
示例9: Item_and_Page_MayDiffer
public void Item_and_Page_MayDiffer()
{
var path = new PathData();
path.CurrentItem = item;
path.CurrentPage = page;
path.CurrentPage.ShouldNotBe(item);
path.CurrentItem.ShouldNotBe(page);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:10,代码来源:PathDataTests.cs
示例10: RewriteRequest
/// <summary>Rewrites a dynamic/computed url to an actual template url.</summary>
public virtual void RewriteRequest(PathData path, RewriteMethod rewriteMethod)
{
if (path == null || path.IsEmpty() || !path.IsRewritable || path.Ignore)
return;
string templateUrl = GetHandlerPath(path);
if(rewriteMethod == RewriteMethod.BeginRequest || rewriteMethod == RewriteMethod.SurroundMapRequestHandler)
WebContext.RewritePath(templateUrl);
else if(rewriteMethod == RewriteMethod.TransferRequest)
WebContext.TransferRequest(templateUrl);
}
开发者ID:spmason,项目名称:n2cms,代码行数:13,代码来源:RequestAdapter.cs
示例11: GetHandlerPath
/// <summary>Gets the path to the handler (aspx template) to rewrite to.</summary>
/// <returns></returns>
protected virtual string GetHandlerPath(PathData path)
{
return path.GetRewrittenUrl();
}
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:6,代码来源:RequestAdapter.cs
示例12: Attach_uses_persister_to_load_stop
public void Attach_uses_persister_to_load_stop()
{
var path = new PathData { StopItem = page };
path = path.Detach();
path.StopItem.ShouldBe(null);
var loadedPath = path.Attach(persister);
loadedPath.StopItem.ID.ShouldBe(1);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:9,代码来源:PathDataTests.cs
示例13: Detach_creates_cloned_object
public void Detach_creates_cloned_object()
{
var path = new PathData();
var detached = path.Detach();
detached.ShouldNotBeSameAs(path);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:7,代码来源:PathDataTests.cs
示例14: BeginScope
/// <summary>Begins a new scope using the current content helper.</summary>
/// <param name="newCurrentPath">The current path to use in the new scope.</param>
/// <returns>An object that restores the scope upon disposal.</returns>
public IDisposable BeginScope(PathData newCurrentPath)
{
if (newCurrentPath == null) return new EmptyDisposable();
return new ContentScope(newCurrentPath, this);
}
开发者ID:meixger,项目名称:n2cms,代码行数:9,代码来源:ContentHelperBase.cs
示例15: AuthorizeRequest
/// <summary>Authorize the user against the current content item. Throw an exception if not authorized.</summary>
/// <param name="user">The user for which to authorize the request.</param>
public virtual void AuthorizeRequest(PathData path, IPrincipal user)
{
SecurityEnforcer.AuthorizeRequest(user, path.CurrentPage, Permission.Read);
}
开发者ID:GrimaceOfDespair,项目名称:n2cms,代码行数:6,代码来源:RequestAdapter.cs
示例16: InjectCurrentPage
public override void InjectCurrentPage(PathData path, System.Web.IHttpHandler handler)
{
logger.Debug("InjectCurrentPage");
base.InjectCurrentPage(path, handler);
}
开发者ID:navneetccna,项目名称:n2cms,代码行数:5,代码来源:AdaptiveRequestAdapter.cs
示例17: Cloned_path_data_should_not_be_same_item
public void Cloned_path_data_should_not_be_same_item()
{
var path = new PathData(page, item);
var clone = path.Clone();
clone.ShouldNotBeSameAs(path);
clone.QueryParameters.ShouldNotBeSameAs(path.QueryParameters);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:8,代码来源:PathDataTests.cs
示例18: PubliclyAvailable_is_determined_by_current
public void PubliclyAvailable_is_determined_by_current()
{
var path = new PathData { CurrentItem = item, CurrentPage = page };
path.IsPubliclyAvailable.ShouldBe(true);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:6,代码来源:PathDataTests.cs
示例19: Detach_removes_reference_to_item_but_leaves_id
public void Detach_removes_reference_to_item_but_leaves_id()
{
var path = new PathData { CurrentItem = page };
path = path.Detach();
path.CurrentItem.ShouldBe(null);
path.ID.ShouldBe(1);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:8,代码来源:PathDataTests.cs
示例20: PubliclyAvailable_is_determined_by_current_nonpublished_page
public void PubliclyAvailable_is_determined_by_current_nonpublished_page(ContentState state, bool expectedAvailability)
{
var path = new PathData { CurrentItem = item, CurrentPage = new Items.PageItem { State = state } };
path.IsPubliclyAvailable.ShouldBe(expectedAvailability);
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:6,代码来源:PathDataTests.cs
注:本文中的N2.Web.PathData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论