mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Adding IJsonConverter service
--HG-- branch : 1.x
This commit is contained in:
parent
e3fa12bcc7
commit
a5763400f3
Binary file not shown.
@ -735,7 +735,12 @@
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.JsonWriter.DateTimeZoneHandling">
|
||||
<summary>
|
||||
Get or set how <see cref="T:System.DateTime"/> time zones are handling when writing JSON.
|
||||
Get or set how <see cref="T:System.DateTime"/> time zones are handling when writing JSON text.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.JsonWriter.StringEscapeHandling">
|
||||
<summary>
|
||||
Get or set how strings are escaped when writing JSON text.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Bson.BsonWriter.#ctor(System.IO.Stream)">
|
||||
@ -1640,6 +1645,50 @@
|
||||
Instructs the <see cref="T:Newtonsoft.Json.JsonSerializer"/> to use the specified constructor when deserializing that object.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Serialization.DiagnosticsTraceWriter">
|
||||
<summary>
|
||||
Represents a trace writer that writes to the application's <see cref="T:System.Diagnostics.TraceListener"/> instances.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Serialization.ITraceWriter">
|
||||
<summary>
|
||||
Represents a trace writer.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Serialization.ITraceWriter.Trace(System.Diagnostics.TraceLevel,System.String,System.Exception)">
|
||||
<summary>
|
||||
Writes the specified trace level, message and optional exception.
|
||||
</summary>
|
||||
<param name="level">The <see cref="T:System.Diagnostics.TraceLevel"/> at which to write this trace.</param>
|
||||
<param name="message">The trace message.</param>
|
||||
<param name="ex">The trace exception. This parameter is optional.</param>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Serialization.ITraceWriter.LevelFilter">
|
||||
<summary>
|
||||
Gets the <see cref="T:System.Diagnostics.TraceLevel"/> that will be used to filter the trace messages passed to the writer.
|
||||
For example a filter level of <code>Info</code> will exclude <code>Verbose</code> messages and include <code>Info</code>,
|
||||
<code>Warning</code> and <code>Error</code> messages.
|
||||
</summary>
|
||||
<value>The <see cref="T:System.Diagnostics.TraceLevel"/> that will be used to filter the trace messages passed to the writer.</value>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Serialization.DiagnosticsTraceWriter.Trace(System.Diagnostics.TraceLevel,System.String,System.Exception)">
|
||||
<summary>
|
||||
Writes the specified trace level, message and optional exception.
|
||||
</summary>
|
||||
<param name="level">The <see cref="T:System.Diagnostics.TraceLevel"/> at which to write this trace.</param>
|
||||
<param name="message">The trace message.</param>
|
||||
<param name="ex">The trace exception. This parameter is optional.</param>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Serialization.DiagnosticsTraceWriter.LevelFilter">
|
||||
<summary>
|
||||
Gets the <see cref="T:System.Diagnostics.TraceLevel"/> that will be used to filter the trace messages passed to the writer.
|
||||
For example a filter level of <code>Info</code> will exclude <code>Verbose</code> messages and include <code>Info</code>,
|
||||
<code>Warning</code> and <code>Error</code> messages.
|
||||
</summary>
|
||||
<value>
|
||||
The <see cref="T:System.Diagnostics.TraceLevel"/> that will be used to filter the trace messages passed to the writer.
|
||||
</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Serialization.JsonContainerContract">
|
||||
<summary>
|
||||
Contract details for a <see cref="T:System.Type"/> used by the <see cref="T:Newtonsoft.Json.JsonSerializer"/>.
|
||||
@ -1746,6 +1795,69 @@
|
||||
</summary>
|
||||
<value>The type name handling.</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Serialization.MemoryTraceWriter">
|
||||
<summary>
|
||||
Represents a trace writer that writes to memory. When the trace message limit is
|
||||
reached then old trace messages will be removed as new messages are added.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Serialization.MemoryTraceWriter.#ctor">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Serialization.MemoryTraceWriter"/> class.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Serialization.MemoryTraceWriter.Trace(System.Diagnostics.TraceLevel,System.String,System.Exception)">
|
||||
<summary>
|
||||
Writes the specified trace level, message and optional exception.
|
||||
</summary>
|
||||
<param name="level">The <see cref="T:System.Diagnostics.TraceLevel"/> at which to write this trace.</param>
|
||||
<param name="message">The trace message.</param>
|
||||
<param name="ex">The trace exception. This parameter is optional.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Serialization.MemoryTraceWriter.GetTraceMessages">
|
||||
<summary>
|
||||
Returns an enumeration of the most recent trace messages.
|
||||
</summary>
|
||||
<returns>An enumeration of the most recent trace messages.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Serialization.MemoryTraceWriter.ToString">
|
||||
<summary>
|
||||
Returns a <see cref="T:System.String"/> of the most recent trace messages.
|
||||
</summary>
|
||||
<returns>
|
||||
A <see cref="T:System.String"/> of the most recent trace messages.
|
||||
</returns>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.Serialization.MemoryTraceWriter.LevelFilter">
|
||||
<summary>
|
||||
Gets the <see cref="T:System.Diagnostics.TraceLevel"/> that will be used to filter the trace messages passed to the writer.
|
||||
For example a filter level of <code>Info</code> will exclude <code>Verbose</code> messages and include <code>Info</code>,
|
||||
<code>Warning</code> and <code>Error</code> messages.
|
||||
</summary>
|
||||
<value>
|
||||
The <see cref="T:System.Diagnostics.TraceLevel"/> that will be used to filter the trace messages passed to the writer.
|
||||
</value>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.StringEscapeHandling">
|
||||
<summary>
|
||||
Specifies how strings are escaped when writing JSON text.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.StringEscapeHandling.Default">
|
||||
<summary>
|
||||
Only control characters (e.g. newline) are escaped.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.StringEscapeHandling.EscapeNonAscii">
|
||||
<summary>
|
||||
All non-ASCII and control characters (e.g. newline) are escaped.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.StringEscapeHandling.EscapeHtml">
|
||||
<summary>
|
||||
HTML (<, >, &, ', ") and control characters (e.g. newline) are escaped.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Newtonsoft.Json.Linq.JRaw">
|
||||
<summary>
|
||||
Represents a raw JSON string.
|
||||
@ -1954,6 +2066,13 @@
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Nullable{System.Char}">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Nullable`1"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Int32">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Int32"/>.
|
||||
@ -1975,6 +2094,20 @@
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Char">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Char"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Byte">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Byte"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Nullable{System.Int32}">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Nullable`1"/>.
|
||||
@ -1996,6 +2129,13 @@
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Nullable{System.Byte}">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Nullable`1"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.DateTime">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.DateTime"/>.
|
||||
@ -2080,6 +2220,41 @@
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Guid">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Guid"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Nullable{System.Guid}">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Guid"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.TimeSpan">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.TimeSpan"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Nullable{System.TimeSpan}">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.TimeSpan"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Explicit(Newtonsoft.Json.Linq.JToken)~System.Uri">
|
||||
<summary>
|
||||
Performs an explicit conversion from <see cref="T:Newtonsoft.Json.Linq.JToken"/> to <see cref="T:System.Uri"/>.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
<returns>The result of the conversion.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Implicit(System.Boolean)~Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Performs an implicit conversion from <see cref="T:System.Boolean"/> to <see cref="T:Newtonsoft.Json.Linq.JToken"/>.
|
||||
@ -2262,6 +2437,41 @@
|
||||
<param name="value">The value to create a <see cref="T:Newtonsoft.Json.Linq.JValue"/> from.</param>
|
||||
<returns>The <see cref="T:Newtonsoft.Json.Linq.JValue"/> initialized with the specified value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Implicit(System.Uri)~Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Performs an implicit conversion from <see cref="T:System.Uri"/> to <see cref="T:Newtonsoft.Json.Linq.JToken"/>.
|
||||
</summary>
|
||||
<param name="value">The value to create a <see cref="T:Newtonsoft.Json.Linq.JValue"/> from.</param>
|
||||
<returns>The <see cref="T:Newtonsoft.Json.Linq.JValue"/> initialized with the specified value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Implicit(System.TimeSpan)~Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Performs an implicit conversion from <see cref="T:System.TimeSpan"/> to <see cref="T:Newtonsoft.Json.Linq.JToken"/>.
|
||||
</summary>
|
||||
<param name="value">The value to create a <see cref="T:Newtonsoft.Json.Linq.JValue"/> from.</param>
|
||||
<returns>The <see cref="T:Newtonsoft.Json.Linq.JValue"/> initialized with the specified value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Implicit(System.Nullable{System.TimeSpan})~Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Performs an implicit conversion from <see cref="T:System.Nullable`1"/> to <see cref="T:Newtonsoft.Json.Linq.JToken"/>.
|
||||
</summary>
|
||||
<param name="value">The value to create a <see cref="T:Newtonsoft.Json.Linq.JValue"/> from.</param>
|
||||
<returns>The <see cref="T:Newtonsoft.Json.Linq.JValue"/> initialized with the specified value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Implicit(System.Guid)~Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Performs an implicit conversion from <see cref="T:System.Guid"/> to <see cref="T:Newtonsoft.Json.Linq.JToken"/>.
|
||||
</summary>
|
||||
<param name="value">The value to create a <see cref="T:Newtonsoft.Json.Linq.JValue"/> from.</param>
|
||||
<returns>The <see cref="T:Newtonsoft.Json.Linq.JValue"/> initialized with the specified value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.op_Implicit(System.Nullable{System.Guid})~Newtonsoft.Json.Linq.JToken">
|
||||
<summary>
|
||||
Performs an implicit conversion from <see cref="T:System.Nullable`1"/> to <see cref="T:Newtonsoft.Json.Linq.JToken"/>.
|
||||
</summary>
|
||||
<param name="value">The value to create a <see cref="T:Newtonsoft.Json.Linq.JValue"/> from.</param>
|
||||
<returns>The <see cref="T:Newtonsoft.Json.Linq.JValue"/> initialized with the specified value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.CreateReader">
|
||||
<summary>
|
||||
Creates an <see cref="T:Newtonsoft.Json.JsonReader"/> for this token.
|
||||
@ -2290,6 +2500,13 @@
|
||||
<typeparam name="T">The object type that the token will be deserialized to.</typeparam>
|
||||
<returns>The new object created from the JSON value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.ToObject(System.Type)">
|
||||
<summary>
|
||||
Creates the specified .NET type from the <see cref="T:Newtonsoft.Json.Linq.JToken"/>.
|
||||
</summary>
|
||||
<param name="objectType">The object type that the token will be deserialized to.</param>
|
||||
<returns>The new object created from the JSON value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.ToObject``1(Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Creates the specified .NET type from the <see cref="T:Newtonsoft.Json.Linq.JToken"/> using the specified <see cref="T:Newtonsoft.Json.JsonSerializer"/>.
|
||||
@ -2298,6 +2515,14 @@
|
||||
<param name="jsonSerializer">The <see cref="T:Newtonsoft.Json.JsonSerializer"/> that will be used when creating the object.</param>
|
||||
<returns>The new object created from the JSON value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.ToObject(System.Type,Newtonsoft.Json.JsonSerializer)">
|
||||
<summary>
|
||||
Creates the specified .NET type from the <see cref="T:Newtonsoft.Json.Linq.JToken"/> using the specified <see cref="T:Newtonsoft.Json.JsonSerializer"/>.
|
||||
</summary>
|
||||
<param name="objectType">The object type that the token will be deserialized to.</param>
|
||||
<param name="jsonSerializer">The <see cref="T:Newtonsoft.Json.JsonSerializer"/> that will be used when creating the object.</param>
|
||||
<returns>The new object created from the JSON value.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JToken.ReadFrom(Newtonsoft.Json.JsonReader)">
|
||||
<summary>
|
||||
Creates a <see cref="T:Newtonsoft.Json.Linq.JToken"/> from a <see cref="T:Newtonsoft.Json.JsonReader"/>.
|
||||
@ -2450,6 +2675,12 @@
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.#ctor(System.Char)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Linq.JValue"/> class with the given value.
|
||||
</summary>
|
||||
<param name="value">The value.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JValue.#ctor(System.UInt64)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Newtonsoft.Json.Linq.JValue"/> class with the given value.
|
||||
@ -3017,7 +3248,10 @@
|
||||
<member name="F:Newtonsoft.Json.DefaultValueHandling.Ignore">
|
||||
<summary>
|
||||
Ignore members where the member value is the same as the member's default value when serializing objects
|
||||
so that is is not written to JSON, and ignores setting members when the JSON value equals the member's default value.
|
||||
so that is is not written to JSON.
|
||||
This option will ignore all default values (e.g. <c>null</c> for objects and nullable typesl; <c>0</c> for integers,
|
||||
decimals and floating point numbers; and <c>false</c> for booleans). The default value ignored can be changed by
|
||||
placing the <see cref="T:System.ComponentModel.DefaultValueAttribute"/> on the property.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Newtonsoft.Json.DefaultValueHandling.Populate">
|
||||
@ -3167,6 +3401,12 @@
|
||||
</summary>
|
||||
<value>The reference resolver.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.JsonSerializerSettings.TraceWriter">
|
||||
<summary>
|
||||
Gets or sets the <see cref="T:Newtonsoft.Json.Serialization.ITraceWriter"/> used by the serializer when writing trace messages.
|
||||
</summary>
|
||||
<value>The trace writer.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.JsonSerializerSettings.Binder">
|
||||
<summary>
|
||||
Gets or sets the <see cref="T:System.Runtime.Serialization.SerializationBinder"/> used by the serializer when resolving type names.
|
||||
@ -4244,7 +4484,7 @@
|
||||
Converts the <see cref="T:System.String"/> to its JSON string representation.
|
||||
</summary>
|
||||
<param name="value">The value to convert.</param>
|
||||
<param name="delimter">The string delimiter character.</param>
|
||||
<param name="delimiter">The string delimiter character.</param>
|
||||
<returns>A JSON string representation of the <see cref="T:System.String"/>.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.JsonConvert.ToString(System.Object)">
|
||||
@ -4743,6 +4983,12 @@
|
||||
Gets or sets the <see cref="T:System.Runtime.Serialization.SerializationBinder"/> used by the serializer when resolving type names.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.JsonSerializer.TraceWriter">
|
||||
<summary>
|
||||
Gets or sets the <see cref="T:Newtonsoft.Json.Serialization.ITraceWriter"/> used by the serializer when writing trace messages.
|
||||
</summary>
|
||||
<value>The trace writer.</value>
|
||||
</member>
|
||||
<member name="P:Newtonsoft.Json.JsonSerializer.TypeNameHandling">
|
||||
<summary>
|
||||
Gets or sets how type name writing and reading is handled by the serializer.
|
||||
@ -5301,6 +5547,34 @@
|
||||
<param name="writer">A <see cref="T:Newtonsoft.Json.JsonWriter"/> into which this method will write.</param>
|
||||
<param name="converters">A collection of <see cref="T:Newtonsoft.Json.JsonConverter"/> which will be used when writing the token.</param>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JObject.GetValue(System.String)">
|
||||
<summary>
|
||||
Gets the <see cref="T:Newtonsoft.Json.Linq.JToken"/> with the specified property name.
|
||||
</summary>
|
||||
<param name="propertyName">Name of the property.</param>
|
||||
<value>The <see cref="T:Newtonsoft.Json.Linq.JToken"/> with the specified property name.</value>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JObject.GetValue(System.String,System.StringComparison)">
|
||||
<summary>
|
||||
Gets the <see cref="T:Newtonsoft.Json.Linq.JToken"/> with the specified property name.
|
||||
The exact property name will be searched for first and if no matching property is found then
|
||||
the <see cref="T:System.StringComparison"/> will be used to match a property.
|
||||
</summary>
|
||||
<param name="propertyName">Name of the property.</param>
|
||||
<param name="comparison">One of the enumeration values that specifies how the strings will be compared.</param>
|
||||
<value>The <see cref="T:Newtonsoft.Json.Linq.JToken"/> with the specified property name.</value>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JObject.TryGetValue(System.String,System.StringComparison,Newtonsoft.Json.Linq.JToken@)">
|
||||
<summary>
|
||||
Tries to get the <see cref="T:Newtonsoft.Json.Linq.JToken"/> with the specified property name.
|
||||
The exact property name will be searched for first and if no matching property is found then
|
||||
the <see cref="T:System.StringComparison"/> will be used to match a property.
|
||||
</summary>
|
||||
<param name="propertyName">Name of the property.</param>
|
||||
<param name="value">The value.</param>
|
||||
<param name="comparison">One of the enumeration values that specifies how the strings will be compared.</param>
|
||||
<returns>true if a value was successfully retrieved; otherwise, false.</returns>
|
||||
</member>
|
||||
<member name="M:Newtonsoft.Json.Linq.JObject.Add(System.String,Newtonsoft.Json.Linq.JToken)">
|
||||
<summary>
|
||||
Adds the specified property name.
|
||||
|
@ -262,6 +262,7 @@
|
||||
<Compile Include="Mvc\Routes\UrlPrefixTests.cs" />
|
||||
<Compile Include="Records\BigRecord.cs" />
|
||||
<Compile Include="Security\DefaultEncryptionServiceTests.cs" />
|
||||
<Compile Include="Services\JsonConverterTests.cs" />
|
||||
<Compile Include="Storage\FileSystemStorageProviderTests.cs" />
|
||||
<Compile Include="Stubs\InMemoryWebSiteFolder.cs" />
|
||||
<Compile Include="Stubs\StubHttpContextAccessor.cs" />
|
||||
|
47
src/Orchard.Tests/Services/JsonConverterTests.cs
Normal file
47
src/Orchard.Tests/Services/JsonConverterTests.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Tests.Services {
|
||||
|
||||
[TestFixture]
|
||||
public class JsonConverterTests {
|
||||
[Test]
|
||||
public void ShouldConvertPrimitiveTypesToJSon() {
|
||||
var converter = new DefaultJsonConverter();
|
||||
|
||||
Assert.That(converter.Serialize(12), Is.EqualTo("12"));
|
||||
Assert.That(converter.Serialize(true), Is.EqualTo("true"));
|
||||
Assert.That(converter.Serialize(12.345), Is.EqualTo("12.345"));
|
||||
Assert.That(converter.Serialize("string"), Is.EqualTo("\"string\""));
|
||||
Assert.That(converter.Serialize(new DateTime(2013, 1, 31, 0, 0, 0, DateTimeKind.Utc)), Is.EqualTo("\"2013-01-31T00:00:00Z\""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldConvertAnonymousTypeToJSon() {
|
||||
dynamic d = JObject.Parse("{number:1000, str:'string', array: [1,2,3,4,5,6]}");
|
||||
|
||||
Assert.That((int)d.number, Is.EqualTo(1000));
|
||||
Assert.That((int)d["number"], Is.EqualTo(1000));
|
||||
Assert.That((int)d.array.Count, Is.EqualTo(6));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldConvertWellKnownTypeToJSon() {
|
||||
var converter = new DefaultJsonConverter();
|
||||
string result = converter.Serialize(new Animal { Age = 12, Name = "Milou" });
|
||||
var o = converter.Deserialize<Animal>(result);
|
||||
|
||||
Assert.That(o.Age, Is.EqualTo(12));
|
||||
Assert.That(o.Name, Is.EqualTo("Milou"));
|
||||
}
|
||||
|
||||
|
||||
public class Animal {
|
||||
public int Age { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -273,6 +273,8 @@
|
||||
<Compile Include="Security\CurrentUserWorkContext.cs" />
|
||||
<Compile Include="Security\Providers\DefaultEncryptionService.cs" />
|
||||
<Compile Include="Services\Clock.cs" />
|
||||
<Compile Include="Services\DefaultJsonConverter.cs" />
|
||||
<Compile Include="Services\IJsonConverter.cs" />
|
||||
<Compile Include="Settings\CurrentSiteWorkContext.cs" />
|
||||
<Compile Include="Settings\ResourceDebugMode.cs" />
|
||||
<Compile Include="Themes\CurrentThemeWorkContext.cs" />
|
||||
|
26
src/Orchard/Services/DefaultJsonConverter.cs
Normal file
26
src/Orchard/Services/DefaultJsonConverter.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Orchard.Services {
|
||||
/// <summary>
|
||||
/// An implementation of <see cref="IJsonConverter"/> using the Newtonsoft.Json library
|
||||
/// </summary>
|
||||
public class DefaultJsonConverter : IJsonConverter {
|
||||
public string Serialize(object o) {
|
||||
return JsonConvert.SerializeObject(o);
|
||||
}
|
||||
|
||||
public string Serialize(object o, JsonFormat format) {
|
||||
return JsonConvert.SerializeObject(o, format == JsonFormat.Indented ? Formatting.Indented : Formatting.None);
|
||||
}
|
||||
|
||||
public dynamic Deserialize(string json) {
|
||||
dynamic result = JObject.Parse(json);
|
||||
return result;
|
||||
}
|
||||
|
||||
public T Deserialize<T>(string json) {
|
||||
return JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
}
|
||||
}
|
42
src/Orchard/Services/IJsonConverter.cs
Normal file
42
src/Orchard/Services/IJsonConverter.cs
Normal file
@ -0,0 +1,42 @@
|
||||
namespace Orchard.Services {
|
||||
/// <summary>
|
||||
/// Provides services to serialize and deserialize objects to and from
|
||||
/// Json documents.
|
||||
/// </summary>
|
||||
public interface IJsonConverter : IDependency {
|
||||
/// <summary>
|
||||
/// Serializes an object to Json.
|
||||
/// </summary>
|
||||
/// <param name="o">The object to serialize.</param>
|
||||
/// <returns>A string representing the object as Json.</returns>
|
||||
string Serialize(object o);
|
||||
|
||||
/// <summary>
|
||||
/// Serializes an object to Json using an optional indentation.
|
||||
/// </summary>
|
||||
/// <param name="o">The object to serialize.</param>
|
||||
/// <param name="format">Whether the document should be indented.</param>
|
||||
/// <returns>A string representing the object as Json.</returns>
|
||||
string Serialize(object o, JsonFormat format);
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a Json document to a dynamic object.
|
||||
/// </summary>
|
||||
/// <param name="json">The Json document to deserialize.</param>
|
||||
/// <returns>The deserialized object.</returns>
|
||||
dynamic Deserialize(string json);
|
||||
|
||||
/// <summary>
|
||||
/// Deserializes a Json document to a specific object.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the object to deserialize.</typeparam>
|
||||
/// <param name="json">The Json document to deserialize.</param>
|
||||
/// <returns>The deserialized object.</returns>
|
||||
T Deserialize<T>(string json);
|
||||
}
|
||||
|
||||
public enum JsonFormat {
|
||||
None,
|
||||
Indented
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user