Last active
June 23, 2016 01:19
-
-
Save dcomartin/e26dab5bd49ca0a5e15005e1b8aef01a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MediatR; | |
using Nancy.Routing; | |
using Nancy.TinyIoc; | |
namespace Nancy.Linker.Demo | |
{ | |
public class MyNancyBootstrapper : DefaultNancyBootstrapper | |
{ | |
protected override void ConfigureApplicationContainer(TinyIoCContainer container) | |
{ | |
base.ConfigureApplicationContainer(container); | |
container.Register<IResourceLinker>( | |
(x, overloads) => | |
new ResourceLinker(x.Resolve<IRouteCacheProvider>(), | |
x.Resolve<IRouteSegmentExtractor>(), x.Resolve<IUriFilter>())); | |
container.Register<IMediator>((x, overloads) => new Mediator(x.Resolve, x.ResolveAll)); | |
container.Register<IAsyncRequestHandler<Features.ChangePricingLevel.Command, Unit>>( | |
(x, overloads) => new Features.ChangePricingLevel.Handler(() => new FakeDb())); | |
container.Register<IAsyncRequestHandler<Features.GetCustomer.Query, Features.GetCustomer.ViewModel>>( | |
(x, overloads) => new Features.GetCustomer.Handler((() => new FakeDb()), x.Resolve<RouteLinker>())); | |
} | |
protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context) | |
{ | |
base.ConfigureRequestContainer(container, context); | |
container.Register<RouteLinker>((x, overloads) => new RouteLinker(x.Resolve<IResourceLinker>(), context)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment