StackExchange.Redis.Extensions icon indicating copy to clipboard operation
StackExchange.Redis.Extensions copied to clipboard

MsgPackObjectSerializer or NewtonsoftSerializer - how to change settings (config) while using DI?

Open PatryxCShark opened this issue 4 years ago • 0 comments

I want to save and read from REDIS an object with interface included:

public class TestObj { public Guid Id { get; set ;} public ICollection<IShape> Shapes { get; set; } }

How can I use MsgPackObjectSerializer? I use DI, so default constructor is used. How can I change settings of MsgPackSerializer?

In Newtonsoft Json I can use JsonSerializerSettings to serialize and deserialize: new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Auto }

which allowed me to serialize and deserialize object with interfaces included. How to set my JsonSerializerSettings if parameterless constructor takes the default settings?

How to do here with Redis and DI?

My version: 5.3.0 (must be compatible with .NET core 2.2)

PatryxCShark avatar Jul 15 '21 07:07 PatryxCShark