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

[MS.DI] Use DryIoc sources directly for the DryIoc.Microsoft.DependencyInjection package #494

Open
dadhi opened this issue Jun 6, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request idea idea of improvement, may be later dropped or considered

Comments

@dadhi
Copy link
Owner

dadhi commented Jun 6, 2022

There are a number of problems with abstracting away from the DryIoc and keeping it as dependency:

  1. We have two IServiceProvider abstractions, the first is the DryIoc.Container itself and the second is the DryIocServiceProvider wrapper inside the MS.DI. The reason for the latter is that the same IServiceProvider object should implement the ISupportRequiredService from the Microsoft.Extensions.DependencyInjection.Abstractions. So either I depend on the MS.DI abstraction package in DryIoc (I don't want to) or I am doubling on the IServiceProvider implementation, complicating things.
  2. The second reason is the performance/memory, and is partially related to the first point. Having additional abstraction build for the MS.DI adapter just for the sake of wrapping things includes the performance cast or indirection and growing memory. Why do I need a separate object for IServiceProvider or for IServiceScopeFactory if this functionality is already implemented in Container. There is open question about the separate scope wrapped implementing a IServiceScope.

Pros:

  • No additional dependency on DryIoc. Consequently, it may simplify usage of the comp-time features delivered with the source content package.
  • Possibility to fine tune the DryIoc internals (think better performance) for the MS.DI without back thought on the general audience. The DryIoc namespace may be changed to the Microsoft.Extensions.DependencyInjection.DryIoc to avoid conflict with the separate DryIoc package.

Cons:

  • Fix in DryIoc requires additional package release.
  • Complexity of handling #if logic in DryIoc sources.
@dadhi dadhi added enhancement New feature or request idea idea of improvement, may be later dropped or considered labels Jun 6, 2022
@dadhi dadhi self-assigned this Jun 6, 2022
@dadhi
Copy link
Owner Author

dadhi commented Jun 6, 2022

//cc @davidfowl If you see that, what are your thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request idea idea of improvement, may be later dropped or considered
Development

No branches or pull requests

1 participant