af1152b001
Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
31 lines
977 B
C#
31 lines
977 B
C#
// <copyright file="NullableEnumModelBinderProvider.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Api.ModelBinders;
|
|
|
|
using System;
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
/// <summary>
|
|
/// Nullable enum model binder provider.
|
|
/// </summary>
|
|
public class NullableEnumModelBinderProvider : IModelBinderProvider
|
|
{
|
|
/// <inheritdoc />
|
|
public IModelBinder? GetBinder(ModelBinderProviderContext context)
|
|
{
|
|
var nullableType = Nullable.GetUnderlyingType(context.Metadata.ModelType);
|
|
if (nullableType is null || !nullableType.IsEnum)
|
|
{
|
|
// Type isn't nullable or isn't an enum.
|
|
return null;
|
|
}
|
|
|
|
var logger = context.Services.GetRequiredService<ILogger<NullableEnumModelBinder>>();
|
|
return new NullableEnumModelBinder(logger);
|
|
}
|
|
}
|