Replies: 1 comment 1 reply
-
IStartupFilter isn't a great middleware composition model because it gives very little control over ordering, and in this case duplication. Calling UseEndpoints multiple times isn't ideal because it will add multiple EndpointMiddleware to the pipeline. I'm not aware of a good built-in solution for this scenario. Do you control the primary Startup class and Configure method? If so you should be able to provide your own interface like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We are building up a collection of .NET Core services. We also have internal libraries that may add middleware. As this collection grows, one of the things we want to maintain is a consistent setup on how middleware is configured; this might change over time.
IStartupFilter
is one way we automatically add middleware. I've been looking around on the Internet, and explored the code from Steeltoe. In their codebase they are usingIStartupFilter
to callUseEndpoints()
. Depending on what has been added to theIServiceCollection
, theUseEndpoints()
will be called multiple times.https://github.com/SteeltoeOSS/Steeltoe/blob/b3928ed4ec527be9fc07e917a615bbebad22c254/src/Management/src/EndpointCore/Loggers/LoggersStartupFilter.cs
https://github.com/SteeltoeOSS/Steeltoe/blob/b3928ed4ec527be9fc07e917a615bbebad22c254/src/Management/src/EndpointCore/Mappings/MappingsStartupFilter.cs
I haven't seen this approach anywhere else, so is this a supported option?
Are there other options I can explore, or do I need to create my own framework specific for our needs?
Beta Was this translation helpful? Give feedback.
All reactions