/// <summary> /// 创建序列化配置 /// </summary> /// <param name="options">格式化选项</param> /// <returns></returns> protected virtual JsonSerializerSettings CreateSerializerSettings(FormatOptions options) { var setting = options.ToSerializerSettings(FormatScope.BsonFormat); setting.Converters.Add(JsonStringConverter.Instance); return(setting); }
/// <summary> /// 创建序列化配置 /// </summary> /// <param name="options">格式化选项</param> /// <returns></returns> protected virtual JsonSerializerSettings CreateSerializerSettings(FormatOptions options) { var useCamelCase = options?.UseCamelCase == true; var setting = options.ToSerializerSettings(FormatScope.KeyValueFormat); setting.Converters.Add(new KeyValuePairConverter(useCamelCase)); return(setting); }
/// <summary> /// 创建序列化配置 /// </summary> /// <param name="options">格式化选项</param> /// <returns></returns> protected virtual JsonSerializerSettings CreateSerializerSettings(FormatOptions options) { return(options.ToSerializerSettings(FormatScope.BsonFormat)); }