Replies: 2 comments
-
Hey Nate! Sorry just seeing this. Feel free to tag me or shoot me a note on twitter if I don't respond in a couple days next time. Regardless, to your question. Yes, there is definitely repetition between environments when working with this setup. This is by design in this case to allow for multiple environments without a ton of complexity. For example, if you only have prod and dev, it's not to bad to toss in a conditional wherever you'd like to manage things (MS actually does this OOTB if you look at their example project), but once you toss in even one more environment (like QA) it can start to become unwieldy. This practice is to encourage a distinct and more explicit approach, though the code duplication can definitely be a downside as well. I'll think about implementing something like you mentioned above, but I also don't want to force people to have particular 'commons' and then have more work to pull it out into different types if needed (naming those doesn't sound fun either lol). With that said, you're more than welcome to use the consolidated approach if you'd like! What you can do is delete all the Startups except the standard Hope that helps. Happy to expand on anything if needed! |
Beta Was this translation helpful? Give feedback.
-
So better late than never, but FYI, after dog fooding the project for a bit I am changing my tune and consolidating startups to a single file. Will be built into the next release |
Beta Was this translation helpful? Give feedback.
-
Forgive me if there is already a way to do this or if there is a reason not to. I'm looking at the various
StartupXXXX.cs
files in theWebApi
project and noticing that there is quite a bit of repeated boilerplate code in theConfigure
andConfigureServices
methods. I have several environments I have set up and changes I'd like to include in all of them. It might be nice to include keeping configuration that is common across all environments in a single place.What do you think of the idea of refactoring the common code into your service extensions (
WebApi/Extensions/AppExtensions.cs
andWebApi/Extensions/ServiceExtensions.cs
)? Alternatively you could just wire up methods for common configuration and leave them blank so idiots like me don't have to do it manually. :)For example:
AppExtensions.cs
ServiceExtensions.cs
Then each of your
StartupXXXX.cs
files would end up like this:Thanks for a great project!
Nate
Beta Was this translation helpful? Give feedback.
All reactions