Api: removed Converters

This commit is contained in:
pavelbannov 2023-08-07 12:33:36 +03:00
parent 3aad0fd8a1
commit 96a612c537
3 changed files with 1 additions and 13 deletions

View File

@ -24,8 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using JsonConverter = System.Text.Json.Serialization.JsonConverter;
namespace ASC.Api.Core;
public abstract class BaseStartup
@ -38,7 +36,6 @@ public abstract class BaseStartup
private readonly IHostEnvironment _hostEnvironment;
private readonly string _corsOrigin;
protected virtual JsonConverter[] Converters { get; }
protected virtual bool AddControllersAsServices { get; }
protected virtual bool ConfirmAddScheme { get; }
protected virtual bool AddAndUseSession { get; }
@ -128,14 +125,6 @@ public abstract class BaseStartup
{
options.JsonSerializerOptions.WriteIndented = false;
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
if (Converters != null)
{
foreach (var c in Converters)
{
options.JsonSerializerOptions.Converters.Add(c);
}
}
};
services.AddControllers().AddJsonOptions(jsonOptions);

View File

@ -29,6 +29,7 @@ namespace ASC.Files.Core.Security;
/// <summary>
/// </summary>
[EnumExtensions]
[JsonConverter(typeof(FileShareConverter))]
public enum FileShare
{
None,

View File

@ -28,8 +28,6 @@ namespace ASC.Files;
public class Startup : BaseStartup
{
protected override JsonConverter[] Converters { get => new JsonConverter[] { new FileShareConverter() }; }
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment)
: base(configuration, hostEnvironment)
{