本文整理汇总了C#中IEngine.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# IEngine.Resolve方法的具体用法?C# IEngine.Resolve怎么用?C# IEngine.Resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEngine
的用法示例。
在下文中一共展示了IEngine.Resolve方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestFixtureSetUp
public virtual void TestFixtureSetUp()
{
engine = CreateEngine();
var configurationBuilder = engine.Resolve<IConfigurationBuilder>();
sessionProvider = (FakeSessionProvider)engine.Resolve<ISessionProvider>();
schemaCreator = new SchemaExport(configurationBuilder.BuildConfiguration());
CreateDatabaseSchema();
engine.Initialize();
}
示例2: NotifyEditing
private void NotifyEditing(IEngine engine, HttpContextWrapper context)
{
var selection = new SelectionUtility(context, engine);
if (Convert.ToBoolean(context.Request["changes"]))
engine.AddActivity(new ManagementActivity { Operation = "Edit", PerformedBy = context.User.Identity.Name, ID = selection.SelectedItem.ID, Path = selection.SelectedItem.Path });
var activities = ManagementActivity.GetActivity(engine, selection.SelectedItem);
var messages = engine.Resolve<N2.Edit.Collaboration.ManagementMessageCollector>()
.GetMessages(CollaborationContext.Create(engine.Resolve<IProfileRepository>(), selection.SelectedItem, context))
.ToList();
context.Response.ContentType = "application/json";
context.Response.Write(ManagementActivity.ToJson(activities, messages));
}
示例3: NotifyViewing
private void NotifyViewing(IEngine engine, HttpContextWrapper context)
{
var selection = new SelectionUtility(context, engine);
if (selection.SelectedItem != null)
engine.AddActivity(new ManagementActivity { Operation = "View", PerformedBy = context.User.Identity.Name, ID = selection.SelectedItem.ID, Path = selection.SelectedItem.Path });
context.Response.WriteJson(new
{
Messages = engine.Resolve<ManagementMessageCollector>()
.GetMessages(CollaborationContext.Create(engine.Resolve<IProfileRepository>(), selection.SelectedItem, context))
.ToList()
});
}
示例4: OnInit
protected override void OnInit(EventArgs e)
{
Engine = N2.Context.Current;
InstallationUtility.CheckInstallationAllowed(Context);
Status = Engine.Resolve<InstallationManager>().GetStatus();
N2.Resources.Register.JQuery(this);
base.OnInit(e);
}
示例5: LinkFixupScheduledAction
public LinkFixupScheduledAction(IItemFinder finder, IPersister persister, IHost host, IFileSystem fs, IEngine engine)
{
_finder = finder;
_persister = persister;
_host = host;
_fs = fs;
_rpp = engine.Resolve<RequestPathProvider>();
}
示例6: TryAppendCreatorNode
/// <summary>Checks access and the drag'n'drop state before adding the creator node to the given collection.</summary>
/// <param name="items"></param>
/// <param name="engine"></param>
/// <param name="parent"></param>
/// <returns></returns>
public static IEnumerable<ContentItem> TryAppendCreatorNode(this IEnumerable<ContentItem> items, IEngine engine, ContentItem parent)
{
var context = engine.Resolve<IWebContext>().HttpContext;
var state = N2.Web.UI.WebControls.ControlPanel.GetState(engine.SecurityManager, context.User, context.Request.QueryString);
if (state != ControlPanelState.DragDrop)
return items;
return items.AppendCreatorNode(engine, parent);
}
示例7: RegisterControllerFactory
public static void RegisterControllerFactory(ControllerBuilder controllerBuilder, IEngine engine)
{
engine.RegisterControllers(Assembly.GetExecutingAssembly());
var controllerFactory = engine.Resolve<ControllerFactoryConfigurator>()
//.NotFound<StartController>(sc => sc.NotFound())
.ControllerFactory;
controllerBuilder.SetControllerFactory(controllerFactory);
}
示例8: RegisterControllerFactory
public void RegisterControllerFactory(ControllerBuilder controllerBuilder, IEngine engine)
{
engine.RegisterAllControllers();
var controllerFactory = engine.Resolve<ControllerFactoryConfigurator>()
.NotFound<StartController>(sc => sc.NotFound())
.ControllerFactory;
controllerBuilder.SetControllerFactory(controllerFactory);
}
示例9: GetAvailableUploadFoldersForAllSites
public static List<HierarchyNode<ContentItem>> GetAvailableUploadFoldersForAllSites(
HttpContext context,
HierarchyNode<ContentItem> root,
List<ContentItem> selectionTrail,
IEngine engine, IFileSystem FS)
{
var uploadDirectories = new List<HierarchyNode<ContentItem>>();
foreach (var upload in engine.Resolve<UploadFolderSource>().GetUploadFoldersForAllSites())
{
var dir = N2.Management.Files.FolderNodeProvider.CreateDirectory(upload, FS, engine.Persister.Repository, engine.Resolve<IDependencyInjector>());
if (!engine.SecurityManager.IsAuthorized(dir, context.User))
continue;
var node = CreateDirectoryNode(FS, dir, root, selectionTrail);
uploadDirectories.Add(node);
}
return uploadDirectories;
}
示例10: RegisterControllerFactory
public static void RegisterControllerFactory(ControllerBuilder controllerBuilder, IEngine engine)
{
// Registers controllers in the solution for dependency injection using the IoC container provided by N2
engine.RegisterAllControllers();
var controllerFactory = engine.Resolve<ControllerFactoryConfigurator>()
.NotFound<Controllers.StartPageController>(sc => sc.NotFound())
.ControllerFactory;
controllerBuilder.SetControllerFactory(controllerFactory);
}
示例11: ContentRoute
public ContentRoute(IEngine engine, IRouteHandler routeHandler, IControllerMapper controllerMapper, Route innerRoute)
{
this.engine = engine;
this.routeHandler = routeHandler ?? new MvcRouteHandler();
this.controllerMapper = controllerMapper ?? engine.Resolve<IControllerMapper>();
this.innerRoute = innerRoute ?? new Route("{controller}/{action}",
new RouteValueDictionary(new { action = "Index" }),
new RouteValueDictionary(),
new RouteValueDictionary(new { this.engine }),
this.routeHandler);
}
示例12: GetActivity
public static IList<ManagementActivity> GetActivity(IEngine engine, ContentItem item)
{
var activities = engine.Resolve<ActivityRepository<ManagementActivity>>().GetActivities(since: Utility.CurrentTime().AddHours(-1));
if (item != null)
activities = activities.Where(a => a.Path == item.Path);
return activities.GroupBy(a => new { a.PerformedBy, a.Operation })
.Select(ag => ag.OrderByDescending(a => a.AddedDate).FirstOrDefault())
.OrderByDescending(a => a.AddedDate)
.Take(5)
.ToList();
}
示例13: ContentRoute
public ContentRoute(IEngine engine, IRouteHandler routeHandler, IControllerMapper controllerMapper, Route innerRoute)
{
managementPath = Url.ToRelative(Url.ResolveTokens(Url.ManagementUrlToken + "/"));
this.engine = engine;
this.routeHandler = routeHandler ?? new MvcRouteHandler();
this.controllerMapper = controllerMapper ?? engine.Resolve<IControllerMapper>();
this.innerRoute = innerRoute ?? new Route("{controller}/{action}",
new RouteValueDictionary(new { action = "Index" }),
new RouteValueDictionary(),
new RouteValueDictionary(new { this.engine }),
this.routeHandler);
}
示例14: SetUp
public override void SetUp()
{
base.SetUp();
root = CreateOneItem<RegularPage>(1, "root", null);
about = CreateOneItem<AboutUsSectionPage>(2, "about", root);
executives = CreateOneItem<ExecutiveTeamPage>(3, "executives", about);
search = CreateOneItem<SearchPage>(4, "search", root);
var typeFinder = new FakeTypeFinder2();
typeFinder.typeMap[typeof(ContentItem)] = this.NearbyTypes()
.BelowNamespace("N2.Extensions.Tests.Mvc.Models").AssignableTo<ContentItem>().Union(typeof(ContentItem)).ToArray();
typeFinder.typeMap[typeof(IController)] = this.NearbyTypes()
.BelowNamespace("N2.Extensions.Tests.Mvc.Controllers").AssignableTo<IController>().Except(typeof(AnotherRegularController))
.ToArray();
var changer = new StateChanger();
var definitions = new DefinitionManager(new[] { new DefinitionProvider(new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase<IUniquelyNamed>[0], TestSupport.SetupEngineSection())) }, new ITemplateProvider[0], new ContentActivator(changer, null, new EmptyProxyFactory()), changer);
httpContext = new FakeHttpContext();
var webContext = new FakeWebContextWrapper(httpContext);
var host = new Host(webContext, root.ID, root.ID);
var parser = TestSupport.Setup(persister, webContext, host);
controllerMapper = new ControllerMapper(typeFinder, definitions);
Url.DefaultExtension = "";
N2.Web.Url.ApplicationPath = "/";
engine = mocks.DynamicMock<IEngine>();
SetupResult.For(engine.Resolve<ITypeFinder>()).Return(typeFinder);
SetupResult.For(engine.Definitions).Return(definitions);
SetupResult.For(engine.UrlParser).Return(parser);
SetupResult.For(engine.Persister).Return(persister);
SetupResult.For(engine.Resolve<RequestPathProvider>()).Return(new RequestPathProvider(webContext, parser, new ErrorNotifier(), new HostSection()));
var editUrlManager = new FakeEditUrlManager();
SetupResult.For(engine.ManagementPaths).Return(editUrlManager);
engine.Replay();
route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null);
routes = new RouteCollection { route };
}
示例15: SetUp
public override void SetUp()
{
base.SetUp();
root = CreateOneItem<RegularPage>(1, "root", null);
about = CreateOneItem<AboutUsSectionPage>(2, "about", root);
executives = CreateOneItem<ExecutiveTeamPage>(3, "executives", about);
search = CreateOneItem<SearchPage>(4, "search", root);
var typeFinder = new FakeTypeFinder2();
typeFinder.typeMap[typeof(ContentItem)] = this.NearbyTypes()
.BelowNamespace("N2.Extensions.Tests.Mvc.Models").AssignableTo<ContentItem>().Union(typeof(ContentItem)).ToArray();
typeFinder.typeMap[typeof(IController)] = this.NearbyTypes()
.BelowNamespace("N2.Extensions.Tests.Mvc.Controllers").AssignableTo<IController>().Except(typeof(AnotherRegularController))
.ToArray();
var editUrlManager = new FakeEditUrlManager();
var definitions = new DefinitionManager(new DefinitionBuilder(typeFinder, new EngineSection(), editUrlManager), new N2.Edit.Workflow.StateChanger(), null, new EmptyProxyFactory());
var webContext = new ThreadContext();
var host = new Host(webContext, root.ID, root.ID);
var parser = new UrlParser(persister, webContext, host, new HostSection());
controllerMapper = new ControllerMapper(typeFinder, definitions);
Url.DefaultExtension = "";
engine = mocks.DynamicMock<IEngine>();
SetupResult.For(engine.Resolve<ITypeFinder>()).Return(typeFinder);
SetupResult.For(engine.Definitions).Return(definitions);
SetupResult.For(engine.UrlParser).Return(parser);
SetupResult.For(engine.Persister).Return(persister);
SetupResult.For(engine.ManagementPaths).Return(editUrlManager);
engine.Replay();
route = new ContentRoute(engine, new MvcRouteHandler(), controllerMapper, null);
httpContext = new FakeHttpContext();
routes = new RouteCollection { route };
}