, чтобы создать сериализатор для довольно простой записи:
Код: Выделить всё
namespace BaseNamespace.OldNameSpace;
[GenerateSerializer, Alias("MyRecord")]
public sealed record MyRecord
{
[Id(0)]
public string Name{ get; set; }
[Id(1)]
public int Age { get; set; }
}
Код: Выделить всё
public sealed class MyRecordGrain([PersistentState(stateName: "MyRecordValue", MyRecordStorageKey")] IPersistentState state) : IGrain, IMyRecordGrain
Код: Выделить всё
{
"$id": "1",
"$type": "BaseNamespace.OldNameSpace.MyRecord, MyProject.Common.Model",
"Name": "Anthony",
"Age ": 14,
},
Код: Выделить всё
Error from storage provider AdoNetGrainStorage.personCache during ReadStateAsync for grain personCache/PersonCacheKey
Exc level 0: Newtonsoft.Json.JsonSerializationException: Error resolving type specified in JSON 'BaseNamespace.OldNameSpace.MyRecord, MyProject.Common.Model], System.Collections.Concurrent'. Path '$type', line 1, position 263.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolveTypeName(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, String qualifiedTypeName)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadMetadataProperties(JsonReader reader, Type& objectType, JsonContract& contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue, Object& newValue, String& id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
Код: Выделить всё
IPersistentStateСпасибо!
Подробнее здесь: https://stackoverflow.com/questions/787 ... g-problems
Мобильная версия