aspnetcore/src/Mvc/test/WebSites/VersioningWebSite/Startup.cs

37 lines
1.1 KiB
C#

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.Extensions.DependencyInjection;
namespace VersioningWebSite
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers(ConfigureMvcOptions)
.AddNewtonsoftJson()
.SetCompatibilityVersion(CompatibilityVersion.Latest);
services.AddScoped<TestResponseGenerator>();
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
}
public virtual void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
});
}
protected virtual void ConfigureMvcOptions(MvcOptions options)
{
}
}
}