/// <summary>Creates a copy of the PathData with a content item retrieved from the supplied persister. The reason for this is that PathData can be cached and we don't want to share instances between requests.</summary> /// <param name="persister">The perister providing the item.</param> /// <returns>A copy of the path data.</returns> public virtual PathData Attach(N2.Persistence.IPersister persister) { PathData data = Clone(); // the persister is used to lazily load persistent CurrentItem/CurrentPage/StopItem data.persister = persister; return(data); }
private void CreatePersister() { mocks.Record(); persister = mocks.DynamicMock<N2.Persistence.IPersister>(); persister.ItemMoving += null; moving = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); persister.ItemCopying += null; copying = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); persister.ItemDeleting += null; deleting = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); persister.ItemSaving += null; saving = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); mocks.Replay(persister); }
private void CreatePersister() { mocks.Record(); persister = mocks.DynamicMock <N2.Persistence.IPersister>(); persister.ItemMoving += null; moving = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); persister.ItemCopying += null; copying = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); persister.ItemDeleting += null; deleting = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); persister.ItemSaving += null; saving = LastCall.IgnoreArguments().Repeat.Any().GetEventRaiser(); mocks.Replay(persister); }
public static void Initialize(N2.Persistence.IPersister persister, ISecurityManager security, ContentActivator activator, N2.Web.IUrlParser urlParser, N2.Web.IWebContext webContext, N2.Configuration.HostSection config) { _webContext = webContext; _security = security; _permissionDeniedHttpCode = config.Web.PermissionDeniedHttpCode; }