NancyFx/Nancy — pull request #714 by codeprogression (2012-08-16 15:26:13+00:00)
Title: Add methods for configuring startup items in ConfigurableBootstrapper

In order to add ApplicationStartup and RequestStartup items, one would
have to subclass `ConfigurableBootstrapper`. The obvious case would be
adding in-memory session or fake authentication handlers. The simplest
case would be to add a user to the context on request startup. This
construct would allow simple cases to be added quickly and easily
without having to subclass `ConfigurableBootstrapper`.

var bootstrapper = new ConfigurableBootstrapper(
with => {
with.ApplicationStartup((container,pipelines) =>
InMemorySession.Enable(pipelines));
with.ApplicationStartup((container,pipelines) =>
FakeFormsAuthentication.Enable(pipelines));
with.RequestStartup((container,pipelines,context) =>
context.Items["foo"]=bar);
with.RequestStartup((container,pipelines,context) =>
context.CurrentUser=fakeUser);
});

- Add configuration method for applicationStartup
- Add configuration method for requestStartup
- Add list containers for application and request startup actions
- Execute the configured startup actions via the respective overload
- Add test to ensure the code is run
- Addresses #713