StackExchange.Redis.Extensions
StackExchange.Redis.Extensions copied to clipboard
MsgPackObjectSerializer or NewtonsoftSerializer - how to change settings (config) while using DI?
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)