Skip to content

Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.

Learn more about Software Architecture & Design.
Join thousands of developers getting weekly updates to increase your understanding of software architecture and design concepts.


Follow @CodeOpinion

Derek Comartin

Environment Variables in ASP.NET Core

In my last post, I covered how to handle sensitive configuration data by using User Secrets while working in development or on your local machine.  The next step is how to use environment variables in ASP.NET Core once you deploy to production (eg Azure App Service)? If you have any questions, please follow me on Twitter.   https://www.youtube.com/watch?v=InyWktgdWJUVideo can’t be loaded because JavaScript is disabled: Multiple Environments in ASP.NET Core (DEV, PROD) (https://www.youtube.com/watch?v=InyWktgdWJU) IHostingEnvironment In your ASP.NET Core Startup class, the ctor has a IHostingEnvironment parameter.  One of the properties on it is the EnvironmentName.  Along with this are a few… Read More »Environment Variables in ASP.NET Core

Sensitive Configuration Data in ASP.NET Core

While working on my new side-project in ASP.NET Core, I was at the point where I needed to start storing sensitive configuration data. Things like my DocumentDB Auth Key, Google OAuth ClientId & Secret, Twilio Auth Token, etc. Depending on your context you may not want to be storing these types of application settings in configuration files that are committed to source control. As you would expect, my local environment for development and once I deploy to Azure have completely different configurations. So how do you change the configuration from local to production? If you are used to using appSettings from the app.config… Read More »Sensitive Configuration Data in ASP.NET Core

Azure Cosmos DB Caching Tips

I’ve started to use Azure Cosmos DB a bit more over the last couple weeks and I’m really enjoying it.  The first real world scenario that I hit was needing to implement optimistic concurrency. This led me straight into I discovered two caching optimizations you can make for better performance accessing individual documents. Caching SelfLinks If you are using the .NET SDK, each document contains a unique SelfLink property.  This is represented by the _self property in the JSON. View the code on Gist. They are guaranteed to be unique and most importantly immutable. Because the SelfLink is immutable we… Read More »Azure Cosmos DB Caching Tips