本文整理汇总了C#中BehaviorGraph.BehaviorFor方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorGraph.BehaviorFor方法的具体用法?C# BehaviorGraph.BehaviorFor怎么用?C# BehaviorGraph.BehaviorFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BehaviorGraph
的用法示例。
在下文中一共展示了BehaviorGraph.BehaviorFor方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
theHttpRequest = OwinHttpRequest.ForTesting();
UrlContext.Stub("http://server");
theUrlResolver = new ChainUrlResolver(theHttpRequest);
theGraph = BehaviorGraph.BuildFrom(registry =>
{
registry.Actions.IncludeType<ChainUrlResolverEndpoint>();
});
theSimpleChain = theGraph.BehaviorFor<ChainUrlResolverEndpoint>(x => x.get_index());
theChainWithRouteParams = theGraph.BehaviorFor(typeof(ChainUrlParams));
}
示例2:
void IConfigurationAction.Configure(BehaviorGraph graph)
{
var chain = graph.BehaviorFor(_route);
_nodes.Each(chain.AddToEnd);
//graph.Observer.RecordStatus("Adding explicit route {0}".ToFormat(_route));
}
示例3: SetUp
public void SetUp()
{
var registry = new FubuRegistry(x => {
x.Actions.IncludeClassesSuffixedWithController();
x.Configure(g =>
{
g.BehaviorFor<AuthorizedController>(c => c.Go(null)).Authorization.AddRole("RoleA");
});
});
graph = BehaviorGraph.BuildFrom(registry);
goChain = graph.BehaviorFor<AuthorizedController>(x => x.Go(null));
moveChain = graph.BehaviorFor<AuthorizedController>(x => x.Move(null));
}
示例4: SetUp
public void SetUp()
{
var registry = new FubuRegistry(x =>
{
x.Actions.IncludeTypesNamed(t => t.EndsWith("Controller"));
x.Configure(g =>
{
g.BehaviorFor<AuthorizedController>(c => c.Go()).Authorization.AddRole("RoleA");
});
});
graph = registry.BuildGraph();
goChain = graph.BehaviorFor<AuthorizedController>(x => x.Go());
moveChain = graph.BehaviorFor<AuthorizedController>(x => x.Move());
}
示例5: Configure
public void Configure(BehaviorGraph graph)
{
var chain = graph.BehaviorFor<TwitterController>(x => x.Button(null));
if (!chain.Output.HasView(typeof(Always)))
{
chain.Output.Writers.AddToEnd(new WriteDefaultTwitterButton());
}
}
示例6: Configure
public void Configure(BehaviorGraph graph)
{
var chain = graph.BehaviorFor<InlineModelEndpoint>(e => e.post_inline_model(null));
var validation = chain.ValidationNode();
if(validation != null)
{
validation.Strategies.RegisterStrategy(RenderingStrategy.Inline);
}
}
示例7: Configure
public void Configure(BehaviorGraph graph)
{
var chain = graph.BehaviorFor(typeof (ValidationSummary));
if (chain == null) return;
if (!chain.Output.HasView(typeof(Always)))
{
chain.Output.Writers.AddToEnd(new DefaultValidationSummaryNode());
}
}
示例8: Configure
public void Configure(BehaviorGraph graph)
{
var chain = graph.BehaviorFor<LoginController>(x => x.Login(null));
if (chain == null) return;
if(!chain.Output.HasView(typeof(Always)))
{
chain.Output.Writers.AddToEnd(new WriteDefaultLogin());
}
}
示例9: action_without_json_attributes_or_JsonMessage_input_model_has_no_conneg
public void action_without_json_attributes_or_JsonMessage_input_model_has_no_conneg()
{
// You have to make the endpoint get some sort of reader/writer to test the negative case,
// otherwise the default "use json & xml if nothing else is provided" convention
// takes over
var registry = new FubuRegistry();
registry.Actions.IncludeType<JsonController>();
registry.Configure(graph =>
{
graph.Behaviors.Where(x => x.InputType() == typeof (Input1)).Each(chain =>
{
chain.Input.AddFormatter<XmlFormatter>();
chain.Output.AddFormatter<XmlFormatter>();
});
});
theGraph = BehaviorGraph.BuildFrom(registry);
var theChain = theGraph.BehaviorFor(typeof (Input1));
theChain.Input.UsesFormatter<JsonFormatter>().ShouldBeFalse();
theChain.Output.UsesFormatter<JsonFormatter>().ShouldBeFalse();
}
示例10: SetUp
public void SetUp()
{
theRegistry = new LoggedFubuRegistry();
// Do it this way so that it gets the assembly package
container = new Container();
theGraph = FubuApplication.For(theRegistry).StructureMap(container)
.Bootstrap().Factory.Get<BehaviorGraph>();
theGraph.BehaviorFor<LoggedEndpoint>(x => x.get_logged_hello()).ShouldNotBeNull();
theLogs = container.GetInstance<ConfigLog>();
}
示例11: SetUp
public void SetUp()
{
FubuTransport.AllQueuesInMemory = true;
container = new Container();
container.Inject(new TransportSettings
{
DelayMessagePolling = Int32.MaxValue,
ListenerCleanupPolling = Int32.MaxValue
});
theServiceBus = MockRepository.GenerateMock<IServiceBus>();
theRuntime = FubuApplication.DefaultPolicies().StructureMap(container).Bootstrap();
theGraph = theRuntime.Factory.Get<BehaviorGraph>();
chain = theGraph.BehaviorFor<MessageOnePublisher>(x => x.post_message1(null));
container.Inject(theServiceBus);
}
示例12:
void IConfigurationAction.Configure(BehaviorGraph graph)
{
graph.BehaviorFor(_route).AddToEnd(_topBehavior);
//graph.Observer.RecordStatus("Adding explicit route {0}".ToFormat(_route));
}
示例13:
void IConfigurationAction.Configure(BehaviorGraph graph)
{
graph.BehaviorFor(_route).Append(_topBehavior);
}
示例14: SetUp
public void SetUp()
{
FubuMode.Reset();
_runtime = FubuApplication.For<ApplicationRegistry>().StructureMap().Bootstrap();
behaviors = _runtime.Factory.Get<BehaviorGraph>();
appChain = behaviors.BehaviorFor<ApplicationActions>(x => x.get_app_action());
pakChain = behaviors.BehaviorFor<PackageActions>(x => x.get_pak_action());
}