-Added JsonDictionaryAttribute

-Added JsonContainerContract
-Added support for customizing the JsonConverter, type name handling, reference handling of collection items
This commit is contained in:
James Newton-King
2012-04-22 23:17:58 +12:00
parent 450996eb25
commit 7b776e9298
34 changed files with 894 additions and 252 deletions
+42 -1
View File
@@ -49,12 +49,21 @@ namespace Newtonsoft.Json
/// <value>The description.</value>
public string Description { get; set; }
/// <summary>
/// Gets the collection's items converter.
/// </summary>
/// <value>The collection's items converter.</value>
public Type ItemConverterType { get; set; }
// yuck. can't set nullable properties on an attribute in C#
// have to use this approach to get an unset default state
internal bool? _isReference;
internal bool? _itemIsReference;
internal ReferenceLoopHandling? _itemReferenceLoopHandling;
internal TypeNameHandling? _itemTypeNameHandling;
/// <summary>
/// Gets or sets a value that indicates whether to preserve object reference data.
/// Gets or sets a value that indicates whether to preserve object references.
/// </summary>
/// <value>
/// <c>true</c> to keep object reference; otherwise, <c>false</c>. The default is <c>false</c>.
@@ -65,6 +74,38 @@ namespace Newtonsoft.Json
set { _isReference = value; }
}
/// <summary>
/// Gets or sets a value that indicates whether to preserve collection's items references.
/// </summary>
/// <value>
/// <c>true</c> to keep collection's items object references; otherwise, <c>false</c>. The default is <c>false</c>.
/// </value>
public bool ItemIsReference
{
get { return _itemIsReference ?? default(bool); }
set { _itemIsReference = value; }
}
/// <summary>
/// Gets or sets the reference loop handling used when serializing the collection's items.
/// </summary>
/// <value>The reference loop handling.</value>
public ReferenceLoopHandling ItemReferenceLoopHandling
{
get { return _itemReferenceLoopHandling ?? default(ReferenceLoopHandling); }
set { _itemReferenceLoopHandling = value; }
}
/// <summary>
/// Gets or sets the type name handling used when serializing the collection's items.
/// </summary>
/// <value>The type name handling.</value>
public TypeNameHandling ItemTypeNameHandling
{
get { return _itemTypeNameHandling ?? default(TypeNameHandling); }
set { _itemTypeNameHandling = value; }
}
/// <summary>
/// Initializes a new instance of the <see cref="JsonContainerAttribute"/> class.
/// </summary>