本文整理汇总了C#中BehaviorGraph.AddChain方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorGraph.AddChain方法的具体用法?C# BehaviorGraph.AddChain怎么用?C# BehaviorGraph.AddChain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BehaviorGraph
的用法示例。
在下文中一共展示了BehaviorGraph.AddChain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addBuiltInDiagnostics
private static void addBuiltInDiagnostics(BehaviorGraph graph)
{
if (FubuMode.InDevelopment())
{
graph.AddChain(RoutedChain.For<AboutDiagnostics>(x => x.get__about(), "_about"));
graph.AddChain(RoutedChain.For<AboutDiagnostics>(x => x.get__loaded(), "_loaded"));
}
}
示例2: SetUp
public void SetUp()
{
_outputPolicy = new AttachOutputPolicy();
_graph = new BehaviorGraph();
_graph.AddChain(BehaviorChain.For<TestEndpoint>(e => e.X()));
_graph.AddChain(BehaviorChain.For<TestEndpoint>(e => e.AnyNumber()));
_outputPolicy.Configure(_graph);
}
示例3: Configure
public void Configure(BehaviorGraph graph)
{
if (!HasLogin(graph))
{
graph.AddChain().AddToEnd(ActionCall.For<LoginController>(x => x.Login(null)));
}
if (!HasLogout(graph))
{
graph.AddChain().AddToEnd(ActionCall.For<LogoutController>(x => x.Logout(null)));
}
}
示例4: should_throw_an_exception_if_the_result_is_not_unique
public void should_throw_an_exception_if_the_result_is_not_unique()
{
var call1 = ActionCall.For<Issue101Endpoint>(x => x.get_hello());
var call2 = ActionCall.For<Issue101Endpoint>(x => x.get_hello());
var graph = new BehaviorGraph();
graph.AddChain().AddToEnd(call1);
graph.AddChain().AddToEnd(call2);
Exception<FubuException>.ShouldBeThrownBy(() => {
graph.ChainFor<Issue101Endpoint>(x => x.get_hello());
});
}
示例5: Configure
public void Configure(BehaviorGraph graph)
{
var handlers = graph.Settings.Get<HandlerGraph>();
// TODO -- move this to a HandlerSource after we fix the duplicate calls
// across HandlerSource problem.
handlers.Add(HandlerCall.For<SubscriptionsHandler>(x => x.Handle(new SubscriptionRequested())));
handlers.Add(HandlerCall.For<SubscriptionsHandler>(x => x.Handle(new SubscriptionsChanged())));
handlers.ApplyGeneralizedHandlers();
var policies = graph.Settings.Get<HandlerPolicies>();
handlers.ApplyPolicies(policies.GlobalPolicies);
foreach (var chain in handlers)
{
// Apply the error handling node
chain.InsertFirst(new ExceptionHandlerNode(chain));
graph.AddChain(chain);
// Hate how we're doing this, but disable tracing
// on the polling job requests here.
if (chain.InputType().Closes(typeof (JobRequest<>)))
{
chain.Tags.Add(BehaviorChain.NoTracing);
}
}
}
示例6: createAssetContentChain
private static BehaviorChain createAssetContentChain(BehaviorGraph graph)
{
var chain = graph.AddChain();
var pattern = "_content";
chain.Route = RouteBuilder.Build(typeof(AssetPath), pattern);
chain.Route.AddHttpMethodConstraint("GET");
return chain;
}
示例7: has_logout_positive
public void has_logout_positive()
{
var graph = new BehaviorGraph();
graph.AddChain().AddToEnd(ActionCall.For<LoginEndpoint>(x => x.get_logout(null)));
FormsAuthenticationEndpointsRegistration.HasLogout(graph)
.ShouldBeTrue();
}
开发者ID:RobertTheGrey,项目名称:FubuMVC.Authentication,代码行数:8,代码来源:FormsAuthenticationEndpointsRegistrationTester.cs
示例8: addReloadedEndpoint
private static void addReloadedEndpoint(BehaviorGraph graph)
{
var action = ActionCall.For<AboutEndpoint>(x => x.get__loaded());
var chain = new BehaviorChain();
chain.AddToEnd(action);
chain.Route = new RouteDefinition("_loaded");
graph.AddChain(chain);
}
示例9: createAssetContentChain
private static BehaviorChain createAssetContentChain(BehaviorGraph graph)
{
var chain = graph.AddChain();
chain.Route = RouteBuilder.Build(typeof (AssetPath), Pattern);
chain.Route.AddHttpMethodConstraint("GET");
chain.Route.SessionStateRequirement = SessionStateRequirement.DoesNotUseSessionState;
return chain;
}
示例10: Configure
public void Configure(BehaviorGraph graph)
{
var route = new RouteDefinition("");
route.AddHttpMethodConstraint("GET");
var chain = new BehaviorChain { Route = route };
chain.AddToEnd(new RedirectNode());
graph.AddChain(chain);
graph.Services.AddService(this);
}
示例11: Configure
public void Configure(BehaviorGraph graph)
{
_sources
.SelectMany(src => src.FindActions(_types))
.Each(call =>
{
var chain = new BehaviorChain();
chain.AddToEnd(call);
graph.AddChain(chain);
});
}
示例12: Configure
public void Configure(BehaviorGraph graph)
{
var actions = _source.FindActions(graph.ApplicationAssembly);
var existing = graph.Actions().ToList();
actions.Where(x => !existing.Contains(x)).Each(call => {
var chain = new BehaviorChain();
chain.AddToEnd(call);
graph.AddChain(chain);
});
}
示例13: buildChain
private void buildChain(BehaviorGraph graph, Type t)
{
var chain = graph.AddChain();
chain.Origin = "SmartGridConvention";
chain.Route = new RouteDefinition("_griddata/" + t.NameForGrid().ToLower());
var call = typeof (GridActionCall<>).CloseAndBuildAs<ActionCall>(t);
chain.AddToEnd(call);
t.GetAllAttributes<ModifyChainAttribute>().Each(att => att.Alter(call));
chain.MakeAsymmetricJson();
}
示例14: Configure
public void Configure(BehaviorGraph graph)
{
// This needs to be forced to true here
_types.ShouldScanAssemblies = true;
_types.TypesMatching(_viewTypeFilter).Each(type =>
{
var chain = graph.AddChain();
var node = _facilities.FirstValue(x => x.CreateViewNode(type));
chain.AddToEnd(node);
_configureChain(chain);
});
}
示例15: Configure
public void Configure(BehaviorGraph graph)
{
if (!_views.Views.Any()) return;
FindLastActions(graph.Behaviors).Each(attachToAction);
_views.Views.Where(x => x.ViewModel != null && !_attached.Contains(x)).Each(view => {
var chain = buildChainForView(view);
chain.Output.AddView(view, Always.Flyweight);
graph.AddChain(chain);
});
}