本文整理汇总了C#中FubuMVC.Core.FubuRegistry.Configure方法的典型用法代码示例。如果您正苦于以下问题:C# FubuRegistry.Configure方法的具体用法?C# FubuRegistry.Configure怎么用?C# FubuRegistry.Configure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FubuMVC.Core.FubuRegistry
的用法示例。
在下文中一共展示了FubuRegistry.Configure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: do_nothing_if_tracing_is_off
public void do_nothing_if_tracing_is_off()
{
var registry = new FubuRegistry();
registry.AlterSettings<DiagnosticsSettings>(x => x.TraceLevel = TraceLevel.None);
registry.Configure(graph =>
{
chain1 = new BehaviorChain();
chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
chain1.Route = new RouteDefinition("something");
graph.AddChain(chain1);
chain2 = new BehaviorChain();
chain2.IsPartialOnly = true;
chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
graph.AddChain(chain2);
});
registry.Policies.Add<ApplyTracing>();
var notTracedGraph = BehaviorGraph.BuildFrom(registry);
notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is DiagnosticBehavior).ShouldBeFalse();
notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is BehaviorTracer).ShouldBeFalse();
}
示例2: Configure
public void Configure(FubuRegistry registry)
{
registry
.Actions
.FindWith<ExplicitControllerRegistration>();
registry
.Views
.TryToAttachWithDefaultConventions()
.TryToAttachViewsInPackages();
registry
.UseSpark(spark => spark.ConfigureComposer(c => c.AddBinder<DiagnosticsTemplateBinder>()));
registry.Configure(graph =>
{
var chain = graph.FindHomeChain();
if (chain == null)
{
graph
.BehaviorFor<GettingStartedController>(x => x.Execute(new GettingStartedRequestModel()))
.Route = new RouteDefinition(string.Empty);
}
});
}
示例3: Configure
public void Configure(FubuRegistry registry)
{
registry.Policies.Add<ApplyTracing>();
registry.Policies.Add<DescriptionVisualizationPolicy>();
registry.Policies.Add<DiagnosticChainsPolicy>();
registry.Services<DiagnosticServiceRegistry>();
registry.Configure(graph => {
var settings = graph.Settings.Get<DiagnosticsSettings>();
if (settings.TraceLevel == TraceLevel.Verbose)
{
graph.Services.Clear(typeof(IBindingLogger));
graph.Services.AddService<IBindingLogger, RecordingBindingLogger>();
graph.Services.Clear(typeof(IBindingHistory));
graph.Services.AddService<IBindingHistory, BindingHistory>();
graph.Services.AddService<ILogListener, RequestTraceListener>();
}
if (settings.TraceLevel == TraceLevel.Production)
{
graph.Services.AddService<ILogListener, ProductionModeTraceListener>();
}
});
registry.Policies.Add<DefaultHome>();
}
示例4: Configure
public void Configure(FubuRegistry registry)
{
MimeType.New("text/jsx", ".jsx");
registry.Services<DiagnosticServiceRegistry>();
registry.AlterSettings<AssetSettings>(x => x.AllowableExtensions.Add(".jsx"));
registry.AlterSettings<DiagnosticsSettings>(x =>
{
x.TraceLevel = TraceLevel.Verbose;
});
registry.Configure(graph => {
var settings = graph.Settings.Get<DiagnosticsSettings>();
if (settings.TraceLevel == TraceLevel.Verbose)
{
graph.Services.Clear(typeof (IBindingLogger));
graph.Services.AddService<IBindingLogger, RecordingBindingLogger>();
graph.Services.Clear(typeof (IBindingHistory));
graph.Services.AddService<IBindingHistory, BindingHistory>();
graph.Services.AddService<ILogListener, RequestTraceListener>();
}
if (settings.TraceLevel == TraceLevel.Production)
{
graph.Services.AddService<ILogListener, ProductionModeTraceListener>();
}
});
}
示例5: Configure
public void Configure(FubuRegistry registry)
{
registry.Configure(graph =>
{
graph.Behaviors.Where(PassportConfiguration.RestrictedAction).Each(c =>
{
var x = new Wrapper(typeof (AuthenticationPolicy));
c.Prepend(x);
});
});
}
示例6: Configure
public void Configure(FubuRegistry registry)
{
registry.Route("_fubu/getting_started").Calls<StartingController>(x => x.GettingStarted());
registry.Configure(graph =>
{
var chain = graph.FindHomeChain();
if (chain == null)
{
graph.BehaviorFor<StartingController>(x => x.GettingStarted()).Route = new RouteDefinition(string.Empty);
}
});
}
示例7: Configure
public void Configure(FubuRegistry registry)
{
registry.Configure(graph =>
{
foreach(var c in graph.Behaviors)
{
if(PassportConfiguration.RestrictedAction(c))
{
}
}
});
}
示例8: setupActions
private BehaviorGraph setupActions()
{
var registry = new FubuRegistry();
registry.Actions.IncludeType<RouteAliasAction1>();
registry.Configure(x =>
{
theRouteDefinitionAlias = new RouteDefinition("{Client}/");
theRouteDefinitionAlias.Input = MockRepository.GenerateMock<IRouteInput>();
theRouteDefinitionAlias.Input.Stub(_ => _.Rank).Return(5);
x.BehaviorFor<RouteAliasAction1>(_ => _.M1()).As<RoutedChain>().AddRouteAlias(theRouteDefinitionAlias);
});
return BehaviorGraph.BuildFrom(registry);
}
示例9: adds_the_authentication_node_if_it_exists
public void adds_the_authentication_node_if_it_exists()
{
var registry = new FubuRegistry();
registry.Actions.IncludeType<AuthenticatedEndpoint>();
registry.Configure(
graph => { graph.Chains.OfType<RoutedChain>().Each(x => x.Authentication = new AuthNode()); });
using (var runtime = registry.ToRuntime())
{
runtime.Behaviors.ChainFor<AuthenticatedEndpoint>(x => x.get_hello())
.First().ShouldBeOfType<AuthNode>();
}
var chain = new RoutedChain("something");
var auth = new AuthNode();
chain.Authentication = auth;
}
示例10: Configure
public void Configure(FubuRegistry registry)
{
var tagPolicy = new AutoCompleteTagPolicy();
registry.Actions.FindWith(new LookupActionSource());
registry.Routes.UrlPolicy<LookupUrlPolicy>();
registry.Import<HtmlConventionRegistry>(x => x.Editors.Add(tagPolicy));
registry.Configure(graph => {
var rules = graph.Settings.Get<AccessorRules>();
// var strategy = new AutoCompleteStringifierStrategy(rules);
// var stringifier = graph.Services.DefaultServiceFor<Stringifier>().Value.As<Stringifier>();
// stringifier.AddStrategy(strategy);
tagPolicy.Rules = rules;
});
}
示例11: do_nothing_if_tracing_is_off
public void do_nothing_if_tracing_is_off()
{
var registry = new FubuRegistry();
registry.Features.Diagnostics.Enable(TraceLevel.None);
registry.Configure(graph =>
{
chain1 = new RoutedChain("something");
chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
graph.AddChain(chain1);
chain2 = new BehaviorChain();
chain2.IsPartialOnly = true;
chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
graph.AddChain(chain2);
});
var notTracedGraph = BehaviorGraph.BuildFrom(registry);
notTracedGraph.Chains.SelectMany(x => x).Any(x => x is BehaviorTracerNode).ShouldBeFalse();
}
示例12: BeforeEach
public void BeforeEach()
{
_parent = new FubuRegistry();
_parent.IncludeDiagnostics(true);
_import = new FubuRegistry();
_import.IncludeDiagnostics(true);
_import.Actions
.IncludeType<Handler1>()
.IncludeType<Handler2>();
_import.Configure(x =>
{
_importObserver = x.Observer;
_importActions = x.Actions()
.Where(a => a.HandlerType.Namespace == GetType().Namespace);
});
_parent.Import(_import, "import");
_parentObserver = _parent.BuildGraph().Observer;
}
示例13: SetUp
public void SetUp()
{
var registry = new FubuRegistry();
registry.Configure(graph =>
{
chain1 = new RoutedChain("something");
chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
graph.AddChain(chain1);
chain2 = new BehaviorChain();
chain2.IsPartialOnly = true;
chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
graph.AddChain(chain2);
});
registry.Features.Diagnostics.Enable(TraceLevel.Verbose);
BehaviorGraph.BuildFrom(registry);
}
示例14: SetUp
public void SetUp()
{
var registry = new FubuRegistry();
registry.Configure(graph =>
{
chain1 = new BehaviorChain();
chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
chain1.Route = new RouteDefinition("something");
graph.AddChain(chain1);
chain2 = new BehaviorChain();
chain2.IsPartialOnly = true;
chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
graph.AddChain(chain2);
});
registry.Policies.Add<ApplyTracing>();
registry.BuildGraph();
}
示例15: 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();
}