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.
abp/framework/test/Volo.Abp.Serialization.Tests/Volo/Abp/Serialization/Objects/CarSerializer.cs

21 lines
584 B

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