Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

21 lines
553 B

using System.Text.Json;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.Serialization.Objects
{
public class CarSerializer : IObjectSerializer<Car>, ITransientDependency
{
public byte[] Serialize(Car obj)
{
obj.Name += "-serialized";
return JsonSerializer.SerializeToUtf8Bytes(obj);
}
public Car Deserialize(byte[] bytes)
{
var car = JsonSerializer.Deserialize<Car>(bytes);
car.Name += "-deserialized";
return car;
}
}
}