Dependency Injection Options

Transient Shortest lifespan : An instance will be created every time one is requested. Each request an instance of given class,the framework will give them each their own instance and not share anything between them   Scoped A single instance will be created for each “scope”.In ASP.NET Core MVC,the “scope” is almost always the current… Read More »

Trust the ASP.NET Core HTTPS development certificate on macOS

Installing the .NET Core SDK installs the ASP.NET Core HTTPS development certificate to the local user certificate store. The certificate has been installed, but it’s not trusted. To trust the certificate perform the one-time step to run the dotnet dev-certs tool: console dotnet dev-certs https –trust

Circuit Breaker Pattern

An implementation of the Circuit Breaker pattern prevents an application from attempting an operation that is likely to fail, acting much like the circuit breaker for the electrical system in a house The circuit breaker acts like a proxy for the application when invoking operations that may fail, particularly where the failure is long lasting.… Read More »

Retry Pattern

If your application experiences a short-lived, temporary (or transient) failure connecting to an external service, it should transparently retry the failed operation. The most common example of this type of transient failure is connecting to a database that is overloaded and responding to new connection requests by refusing the connection(A website retrying to connect with… Read More »

Some Useful Patterns for Web Sites and WebJobs

USEFUL FOR WEBSITES AND WEBJOBS ■ Static Content Hosting pattern ■ Cache-Aside pattern ■ Health Endpoint Monitoring pattern ■ Compensating Transaction pattern ■ Command and Query Responsibility Segregation pattern USEFUL FOR WEBJOBS ■ Competing Consumers pattern ■ Priority Queue pattern ■ Queue-Based Load Leveling pattern ■ Leader Election pattern ■ Scheduler Agent Supervisor pattern

Throttling Pattern

When a website returns a 503 Service Unavailable status to a client, it is typically informing the browser that it is overloaded. This is an example of throttling in action. The throttling pattern quickly responds to increased load by restricting the consumption of resources by an application instance, a tenant, or an entire service so… Read More »

A brief look at Document Db

What is a Document Database? A document database,also called a document store or document-oriented database,is a subset of a type of NoSQL database.Some documents stores ma also be key-value databases(Like Redis).A document database is used for storing,retrieving,and managing semi-structured data.Unlike traditional databases,the data model in a document database is not structured in a table format… Read More »

Creating Custom Media Format with ASP.NET Web API

We can create our own media formats in the ASP.NET Web API project First of all, as root you create a folder called Formatters And we create a class in this folder for the format we want to define(For example for csv format)   using System.Web.Http; using System.Web.Mvc; using Kartal.Formatters; public class DemoItemCsvFormatter : BufferedMediaTypeFormatter… Read More »

Automatically validate antiforgery tokens for unsafe HTTP methods only

ASP.NET Core apps don’t generate antiforgery tokens for safe HTTP methods (GET, HEAD, OPTIONS, and TRACE). Instead of broadly applying the ValidateAntiForgeryToken attribute and then overriding it with IgnoreAntiforgeryToken attributes, the AutoValidateAntiforgeryToken attribute can be used. This attribute works identically to the ValidateAntiForgeryToken attribute, except that it doesn’t require tokens for requests made using the following HTTP methods: GET HEAD OPTIONS TRACE Recommended… Read More »