The importance of request identity
ASP.NET Core One of the more important aspect of API development is we have to give each request an identity. This is especially important if we are logging each request & response for tracing, caching, or validation. In case of ASP.NET Core, a request identity could be injected at the scoped level where it will lives through the life-cycle of a request. To bind the request data, we could use a middleware. Since the class is injected at the scoped level, each access to the class/object would be the same within the request life-cycle. A class to store the information of a request. public class RequestIdentity { public string ClientKey { get ; set ; } public RequestIdentity() {} public void BindRequestData( string clientKey) { ClientKey = clientKey; } } Using a middleware, we could easily bind the required information into the class. Let's assume the client key is supposedly being included in the header. public class RequestIdentityInit...