Exemplo n.º 1
0
        public static JsonSerializerSettings DefaultSettings(TypeNameRegistry?typeNameRegistry = null)
        {
            return(new JsonSerializerSettings
            {
                SerializationBinder = new TypeNameSerializationBinder(typeNameRegistry ?? new TypeNameRegistry()),

                ContractResolver = new ConverterContractResolver(
                    new ClaimsPrincipalConverter(),
                    new DomainIdConverter(),
                    new EnvelopeHeadersConverter(),
                    new FilterConverter(),
                    new InstantConverter(),
                    new JsonValueConverter(),
                    new LanguageConverter(),
                    new NamedDomainIdConverter(),
                    new NamedGuidIdConverter(),
                    new NamedLongIdConverter(),
                    new NamedStringIdConverter(),
                    new PropertyPathConverter(),
                    new RefTokenConverter(),
                    new StringEnumConverter()),

                TypeNameHandling = TypeNameHandling.Auto
            });
        }
Exemplo n.º 2
0
        public static JsonSerializerSettings DefaultSettings(TypeNameRegistry?typeNameRegistry = null)
        {
            return(new JsonSerializerSettings
            {
                SerializationBinder = new TypeNameSerializationBinder(typeNameRegistry ?? new TypeNameRegistry()),

                ContractResolver = new ConverterContractResolver(
                    new SurrogateConverter <ClaimsPrincipal, ClaimsPrinicpalSurrogate>(),
                    new EnvelopeHeadersConverter(),
                    new JsonValueConverter(),
                    new SurrogateConverter <FilterNode <IJsonValue>, JsonFilterSurrogate>(),
                    new StringEnumConverter()),

                TypeNameHandling = TypeNameHandling.Auto
            }.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb));
        }
Exemplo n.º 3
0
        public static IJsonSerializer CreateSerializer(TypeNameRegistry?typeNameRegistry = null)
        {
            var serializerSettings = DefaultSettings(typeNameRegistry);

            return(new NewtonsoftJsonSerializer(serializerSettings));
        }