You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've started using the HierarchyId for a Blazor project I've started and it's was failing as it's use Json for serialize/deserialize object and HierarchyId doesn't have one. I've create a simple converter to perform the task. I'm not sure if this should belong in this repository or not.
using Microsoft.EntityFrameworkCore;using System;using System.Text.Json;using System.Text.Json.Serialization;namespaceANamespace{publicclassHierarchyIdConverter:JsonConverter<HierarchyId>{publicoverride HierarchyId Read(refUtf8JsonReaderreader,TypetypeToConvert,JsonSerializerOptionsoptions){return HierarchyId.Parse(reader.GetString());}publicoverridevoidWrite(Utf8JsonWriterwriter,HierarchyIdvalue,JsonSerializerOptionsoptions){
writer.WriteStringValue(value.ToString());}}}
The text was updated successfully, but these errors were encountered:
Changes:
- Make HierarchyId compatible with System.Text.Json (resolvesefcore/EFCore.SqlServer.HierarchyId#40)
- Add HierarchyId constructors
- Add overloads and clarify docs for GetDescendant
- Improve interop with SqlHierarchyId
- Translate calls on constants (fixesdotnet#30307)
- Don't go through SqlBytes (resolvesdotnet#30305)
Part of dotnet#30306
I've started using the HierarchyId for a Blazor project I've started and it's was failing as it's use Json for serialize/deserialize object and HierarchyId doesn't have one. I've create a simple converter to perform the task. I'm not sure if this should belong in this repository or not.
The text was updated successfully, but these errors were encountered: