- .NET Core SDK 2.2 (2.2.104 at the time of writing) [download]
- Visual Studio 2017 or Visual Studio Code
- What is a middleware
- How to create one
- What are health checks
- How do they work
- How to set it up
async ct =>
{
using (var connection = new SqlConnection(_configuration.GetConnectionString("BlogDatabase")))
{
await connection.OpenAsync(ct);
using (var command = new SqlCommand("SELECT 1", connection))
{
await command.ExecuteScalarAsync(ct);
}
return HealthCheckResult.Healthy();
}
}
UseHealthChecks("/healthcheck", new HealthCheckOptions {Predicate = hc => hc.Tags.Contains("db")})
Nuget packages:
- How does it work
- Setup
BlogSettings
options- from .json
- from .xml
- from
Action<T>
- How to use default DI
- What are the limitations
- How to refactor to 3rd party DI (AutoFac)
.ConfigureServices(services => services.AddAutofac())
public void ConfigureContainer(ContainerBuilder builder)
{
builder.RegisterType<BlogRepository>().As<IBlogRepository>();
}
public IServiceProvider ConfigureServices(IServiceCollection services)
{
//
var containerBuilder = new ContainerBuilder();
containerBuilder.Populate(services);
containerBuilder.RegisterType<BlogRepository>().As<IBlogRepository>();
return new AutofacServiceProvider(containerBuilder.Build());
}
- Default logging framework
- Adding 3rd party loggers (NLog)
- How to abstract dependency of physical file and write testable code
- Setup Swagger JSON
- Setup Swagger UI
- Create custom
ApiInfo
view
Nuget packages:
- Difference between Razor Pages and Views
- Introduction to View Components
Razor pages - Introduction to Razor Pages in ASP.NET Core
@page
public class BlogModel : PageModel
public async Task OnGetAsync()
{
//
}
View components - View components in ASP.NET Core
[ViewComponent(Name = "Blog")]
public class BlogComponent : ViewComponent
public Task<IViewComponentResult> InvokeAsync(Blog blog)
{
//
}
<vc:blog blog="blog"></vc:blog>
Startup.cs
integration testing- Code coverage
dotnet test .\Workshop.App.Tests\ /p:CollectCoverage=true /p:Exclude="[xunit.*]*"