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

MSDI: Support returning IServiceProvider scenario dependencies with the ME.DI plugin #383

Conversation

robertcoltheart
Copy link

🤔 What's changed?

The ME.DI plugin can now return an IServiceProvider from the static method, in addition to supporting the IServiceCollection type.

⚡️ What's your motivation?

This supports scenarios when integration testing ASP.NET Core projects, where we have a service container built and owned by the WebApplicationFactory (or other scenarios). The downside is that you must manually register the bindings, but there is already precedent for this in the Windsor plugin, where we have to do the same.

There is no change to the public API other than being able to return IServiceProvider from the static method. The AutoRegisterBindings setting is ignored when returning IServiceProvider and I've added some xmldoc comments to that effect.

🏷️ What kind of change is this?

  • 📖 Documentation (improvements without changing code)
  • 💥 Breaking change (incompatible changes to the API)

♻️ Anything particular you want feedback on?

📋 Checklist:

  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "[vNext]" section of the CHANGELOG, linking to this pull request & included my GitHub handle to the release contributors list.

This text was originally taken from the template of the Cucumber project, then edited by hand. You can modify the template here.

@robertcoltheart robertcoltheart changed the title Use service provider with the ME.DI plugin Support returning IServiceProvider scenario dependencies with the ME.DI plugin Jan 5, 2025
@gasparnagy gasparnagy changed the title Support returning IServiceProvider scenario dependencies with the ME.DI plugin MSDI: Support returning IServiceProvider scenario dependencies with the ME.DI plugin Jan 10, 2025
@robertcoltheart robertcoltheart closed this by deleting the head repository Jan 30, 2025
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

Successfully merging this pull request may close these issues.

1 participant