Overview of ASP.NET Core Middleware Extensibility Sample
mainThis sample demonstrates different ways to activate middleware in ASP.NET Core, specifically focusing on scenarios described in 'Factory-based middleware activation'. It compares conventional middleware activation against activation via the IMiddleware interface.
The sample implements middleware that:
- Reads a value from a query string parameter named
key. - Uses an injected database context (a scoped service) to record that value in an in-memory database.
This demonstrates how middleware can interact with scoped services through different activation patterns.