diff --git a/aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProJsonSerializer.cs b/aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProJsonSerializer.cs deleted file mode 100644 index e7c4e266..00000000 --- a/aspnet-core/frameworks/src/Lion.AbpPro.CAP/Lion/AbpPro/CAP/AbpProJsonSerializer.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Lion.AbpPro.CAP; - -public class AbpProJsonSerializer : ISerializer, ISingletonDependency -{ - private readonly IJsonSerializer _jsonSerializer; - - public AbpProJsonSerializer(IJsonSerializer jsonSerializer) - { - _jsonSerializer = jsonSerializer; - } - - public virtual string Serialize(Message message) - { - return _jsonSerializer.Serialize(message); - } - - public virtual ValueTask SerializeAsync(Message message) - { - if (message == null) - { - throw new ArgumentNullException(nameof(message)); - } - - if (message.Value == null) - { - return new ValueTask(new TransportMessage(message.Headers, null)); - } - - var json = _jsonSerializer.Serialize(message.Value); - - return new ValueTask(new TransportMessage(message.Headers, Encoding.UTF8.GetBytes(json))); - } - - public virtual Message Deserialize(string json) - { - return _jsonSerializer.Deserialize(json); - } - - public virtual ValueTask DeserializeAsync(TransportMessage transportMessage, Type valueType) - { - if (valueType == null || transportMessage.Body.IsEmpty) - { - return new ValueTask(new Message(transportMessage.Headers, null)); - } - - var json = Encoding.UTF8.GetString(transportMessage.Body.ToArray()); - - return new ValueTask(new Message(transportMessage.Headers, - _jsonSerializer.Deserialize(valueType, json))); - } - - public virtual object Deserialize(object value, Type valueType) - { - return _jsonSerializer.Deserialize(valueType, value.ToString()); - } - - public virtual bool IsJsonType(object jsonObject) - { - return jsonObject is JsonElement; - } -} \ No newline at end of file