using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Collections.ObjectModel;
using System.Text.Json.Serialization;
using System.Text.Json.Serialization.Metadata;
using System.Text.Json.Nodes;
public interface Dto<T> : Dto where T : Entity.Entity;
[JsonDerivedType(derivedType: typeof(CourseDto))]
[JsonDerivedType(derivedType: typeof(DeletedDto))]
[JsonPolymorphic(UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FallBackToNearestAncestor)]
public sealed record DeletedDto(string Id) : Dto;
public sealed record CourseDto(
public sealed record SynchronizableWrapper<T>(T[]? Added, T[]? Updated, DeletedDto[]? Deleted)
: SynchronizableWrapper(Added, Updated, Deleted) where T : class, Dto
public new T[]? Added => (T[]?) base.Added;
public new T[]? Updated => (T[]?) base.Updated;
public new DeletedDto[]? Deleted => base.Deleted;
public record SynchronizableWrapper(Dto[]? Added, Dto[]? Updated, DeletedDto[]? Deleted)
public Dto[]? Added { get; set; } = Added;
public Dto[]? Updated { get; set; } = Updated;
public DeletedDto[]? Deleted { get; set; } = Deleted;
public static void Test()
public static void Main()
Console.WriteLine("Environment version: {0} ({1}), {2}", System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription , Environment.Version, Environment.OSVersion);
Console.WriteLine("System.Text.Json version: " + typeof(JsonSerializer).Assembly.FullName);
Console.WriteLine("Failed with unhandled exception: ");