Defining the application layer
As a first step, for simplicity, let’s freeze the application culture to en-US
by adding the following code to the ASP.NET Core pipeline:
app.UseAuthorization();
// Code to add: configure the Localization middleware
var ci = new CultureInfo("en-US");
app.UseRequestLocalization(new RequestLocalizationOptions
{
DefaultRequestCulture = new RequestCulture(ci),
SupportedCultures = new List<CultureInfo>
{
ci,
},
SupportedUICultures = new List<CultureInfo>
{
ci,
}
});
Then, let’s create a Tools
folder and place the ApplicationLayer
code there, which you can find in the ch11
code of the GitHub repository associated with this book. With these tools in place, we can add the code that automatically discovers and adds all queries, command handlers, and event handlers to the DI engine, as shown here:
...
...
builder.Services.AddAllQueries(this.GetType().Assembly);
builder...