Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Changing AddFhirServer with an optional parameter for MVC. #3566

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,30 @@ public static class FhirServerServiceCollectionExtensions
/// <param name="services">The services collection.</param>
/// <param name="configurationRoot">An optional configuration root object. This method uses "FhirServer" section.</param>
/// <param name="configureAction">An optional delegate to set <see cref="FhirServerConfiguration"/> properties after values have been loaded from configuration</param>
/// <param name="addMvc">An optional flag indicating wheter to register ASP.NET MVC components.</param>
/// <returns>A <see cref="IFhirServerBuilder"/> object.</returns>
public static IFhirServerBuilder AddFhirServer(
this IServiceCollection services,
IConfiguration configurationRoot = null,
Action<FhirServerConfiguration> configureAction = null)
Action<FhirServerConfiguration> configureAction = null,
bool addMvc = true)
{
EnsureArg.IsNotNull(services, nameof(services));

services.AddOptions();
services.AddMvc(options =>
{
options.EnableEndpointRouting = false;
options.RespectBrowserAcceptHeader = true;
})
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.DateParseHandling = Newtonsoft.Json.DateParseHandling.DateTimeOffset;
})
.AddRazorRuntimeCompilation();
if (addMvc)
{
services.AddMvc(options =>
{
options.EnableEndpointRouting = false;
options.RespectBrowserAcceptHeader = true;
})
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.DateParseHandling = Newtonsoft.Json.DateParseHandling.DateTimeOffset;
})
.AddRazorRuntimeCompilation();
}

var fhirServerConfiguration = new FhirServerConfiguration();

Expand Down