This repository has been archived by the owner on Jan 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Module registration changes #998
Merged
thecodejunkie
merged 12 commits into
NancyFx:master
from
grumpydev:ModuleRegistrationChanges
Feb 20, 2013
Merged
Module registration changes #998
thecodejunkie
merged 12 commits into
NancyFx:master
from
grumpydev:ModuleRegistrationChanges
Feb 20, 2013
Conversation
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
We were registering every module on every request, which is slow and wasteful when we only resolve one per request. Changed it so now we store the module type rather than the "key", and with the per request container bootstrappers we register a single module per request, then resolve it. Not 100% sure if we should split out the register and resolve calls in the classes that derrive from the request container base class (currently it expects them to register and resolve in the GetModule method) Currently non-request container bootstrappers are broken.
@@ -51,14 +51,14 @@ public override sealed IEnumerable<INancyModule> GetAllModules(NancyContext cont | |||
} | |||
|
|||
/// <summary> | |||
/// Gets a specific, per-request, module instance from the key | |||
/// Retrieves a specific <see cref="NancyModule"/> implementation - should be per-request lifetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking but it should probably say INancyModule
and not NancyModule
@@ -487,12 +438,12 @@ public override IEnumerable<INancyModule> GetAllModules(NancyContext context) | |||
} | |||
|
|||
/// <summary> | |||
/// Retrieves a specific <see cref="NancyModule"/> implementation based on its key | |||
/// Retrieves a specific <see cref="NancyModule"/> implementation - should be per-request lifetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another INancyModule
;)
thecodejunkie
added a commit
that referenced
this pull request
Feb 20, 2013
Module registration changes
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Switched per-request module registration so only a single module is registered - the fact we registered all of them was wasteful because we guarantee we only resolve one per request anyway - this gives a massive per-request speedup when using lots of modules.
Module key generator is gone as part of this change.
Other boostrappers will need to be updated.
Also update TinyIoC - optimised the speed of AutoRegister to reduce startup times with lots of types defined.