Core
Core
Explore posts from servers
CC#
Created by Core on 11/19/2024 in #help
✅ How is JsonConverter(typeof(JsonStringEnumConverter<MyEnum>)) evaluated?
Thank you so much
10 replies
CC#
Created by Core on 11/19/2024 in #help
✅ How is JsonConverter(typeof(JsonStringEnumConverter<MyEnum>)) evaluated?
This guy serializes 😄
10 replies
CC#
Created by Core on 11/19/2024 in #help
✅ How is JsonConverter(typeof(JsonStringEnumConverter<MyEnum>)) evaluated?
This seemed to work
c.Serializer.Options.TypeInfoResolver =
JsonTypeInfoResolver.Combine(c.Serializer.Options.TypeInfoResolver, EnumJsonSerializer.Default);
c.Serializer.Options.TypeInfoResolver =
JsonTypeInfoResolver.Combine(c.Serializer.Options.TypeInfoResolver, EnumJsonSerializer.Default);
10 replies
CC#
Created by Core on 11/19/2024 in #help
✅ How is JsonConverter(typeof(JsonStringEnumConverter<MyEnum>)) evaluated?
I think this way the default serializer gets overridden, is there a way I could specify the default JsonTypeInfoResolver for the Combine() method?
10 replies
CC#
Created by Core on 11/19/2024 in #help
✅ How is JsonConverter(typeof(JsonStringEnumConverter<MyEnum>)) evaluated?
there is one problem with that, I configured the source generation after the docs. But now the serialization only works with those classes, any other DTO, even the ones not using enums will throw an exteption. This means that for every new DTO 2 more classes must be added to the serializer, this is really inconvenient. Or I might be doing something wrong
c#
[JsonSourceGenerationOptions(UseStringEnumConverter = true)]
[JsonSerializable(typeof(ListLinksRequest))]
[JsonSerializable(typeof(ListLinksResult))]
public partial class EnumJsonSerializer : JsonSerializerContext;
c#
[JsonSourceGenerationOptions(UseStringEnumConverter = true)]
[JsonSerializable(typeof(ListLinksRequest))]
[JsonSerializable(typeof(ListLinksResult))]
public partial class EnumJsonSerializer : JsonSerializerContext;
Program.cs
c#
c.Serializer.Options.TypeInfoResolver = JsonTypeInfoResolver.Combine(EnumJsonSerializer.Default);
c#
c.Serializer.Options.TypeInfoResolver = JsonTypeInfoResolver.Combine(EnumJsonSerializer.Default);
10 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
$close
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
Now it works, thank you, I still don't understand what has the response to do with the serializer
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
the request is serialized
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
Yes, the result is failing
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
and it is the response
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
But there is no enum being used here
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
That's being returned, specifically GetLinkMetricsResult<LinkClicksByDateResult>
c#
public class GetLinkMetricsResult<T>
{
public IEnumerable<T> Metrics { get; set; } = null!;
}

public class LinkClicksByDateResult : ILinkMetricsResult
{
public int Clicks { get; set; }
public LocalDate Date { get; set; }
}
c#
public class GetLinkMetricsResult<T>
{
public IEnumerable<T> Metrics { get; set; } = null!;
}

public class LinkClicksByDateResult : ILinkMetricsResult
{
public int Clicks { get; set; }
public LocalDate Date { get; set; }
}
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
c#
'AnalyticsService.Api.Features.LinkMetrics.Models.GetLinkMetricsResult`1[AnalyticsService.Api.Features.LinkMetrics.Models.LinkClicksByDateResult]'
c#
'AnalyticsService.Api.Features.LinkMetrics.Models.GetLinkMetricsResult`1[AnalyticsService.Api.Features.LinkMetrics.Models.LinkClicksByDateResult]'
21 replies
CC#
Created by Core on 11/18/2024 in #help
✅ .NET 8 enum to string serialization throws an exception
sorry, I had no idea that's relevant
21 replies
CC#
Created by vendeten on 10/17/2024 in #help
having problems with random number generator in uni project
Visual Studio only has problem with the C language, it is perfectly fine for C#
65 replies
CC#
Created by vendeten on 10/17/2024 in #help
having problems with random number generator in uni project
My beloved Rider....
65 replies
CC#
Created by vendeten on 10/17/2024 in #help
having problems with random number generator in uni project
Sorry mb, it isn't a binary search. But I don't see the problem
65 replies
CC#
Created by vendeten on 10/17/2024 in #help
having problems with random number generator in uni project
So basically a binary search with extra steps
65 replies
CC#
Created by reeeeeee on 10/17/2024 in #help
How do you implement paging on API requests?
Ohhh.... thanks
11 replies
CC#
Created by reeeeeee on 10/17/2024 in #help
How do you implement paging on API requests?
Sorry, but what use does Paginate<T> have here?
11 replies