Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Turn on Scope Validation by default #483

Closed
burningice2866 opened this issue Sep 22, 2017 · 4 comments
Closed

Feature Request: Turn on Scope Validation by default #483

burningice2866 opened this issue Sep 22, 2017 · 4 comments

Comments

@burningice2866
Copy link
Contributor

As of May 10th, newer versions of the Microsoft Dependency Injection has turned on scope validation by default (https://github.com/aspnet/DependencyInjection/releases/tag/rel%2F2.0.0-preview1) which i believe would be the right thing to do in C1 as well as long as we're using version < 2.0.

This requires a simple change to this line https://github.com/Orckestra/C1-CMS-Foundation/blob/dev/Composite/Core/ServiceLocator.cs#L25, where true is passed to the BuildServiceProvider method.

I'd be happy to send a PR if you agree in making this change.

@mawtex
Copy link
Collaborator

mawtex commented Sep 22, 2017

Please do - optimal if you can run the nightwatch tests and check they pass okay.

burningice2866 added a commit to burningice2866/C1-CMS that referenced this issue Sep 22, 2017
burningice2866 added a commit to burningice2866/C1-CMS that referenced this issue Sep 22, 2017
@burningice2866
Copy link
Contributor Author

burningice2866 commented Sep 22, 2017

Looking closer at the aspnet/DependencyInjection#481 thread, it turns out they are only enabling Scope Validation when the application is running in Development Mode which i've updated my code to mimic by looking at the Debug Compilation Flag.

This makes sense since Scope Validation has a slight performance overhead and its mainly during development you want the extra checking to see if you messed up in one of your service registrations.

@burningice2866
Copy link
Contributor Author

@mawtex ... and then what, something i'm missing here?

@burningice2866
Copy link
Contributor Author

Implemented in #484

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants