-Updated source code to VS2010

-Updated main project to .NET 4.0
-Updated to psake 4.0
-Changed assembly version to 4.0.0.0
-Added ICustomTypeDescriptor implementation to JObject, removed JTypeDescriptionProvider and JTypeDescriptor
-Changed serialization of collections to use iterator rather than indexer
-Removed Compact Framework project
-Fixed XML documentation warnings
This commit is contained in:
JamesNK
2010-08-31 02:19:41 +00:00
parent 97d9cf82ef
commit 12a91cce9e
37 changed files with 1686 additions and 1932 deletions
+8 -5
View File
@@ -1,4 +1,5 @@
properties { properties {
$zipFileName = "Json35r8.zip" $zipFileName = "Json35r8.zip"
$signAssemblies = $false $signAssemblies = $false
$signKeyPath = "D:\Development\Releases\newtonsoft.snk" $signKeyPath = "D:\Development\Releases\newtonsoft.snk"
@@ -12,13 +13,14 @@
$releaseDir = "$baseDir\Release" $releaseDir = "$baseDir\Release"
$workingDir = "$baseDir\Working" $workingDir = "$baseDir\Working"
$builds = @( $builds = @(
@{Name = "Newtonsoft.Json.Silverlight"; TestsName = "Newtonsoft.Json.Tests.Silverlight"; Constants="SILVERLIGHT"; FinalDir="Silverlight"}, @{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="DotNet"; Framework="net-4.0"},
@{Name = "Newtonsoft.Json.Compact"; TestsName = "Newtonsoft.Json.Tests.Compact"; Constants="PocketPC"; FinalDir="Compact"}, @{Name = "Newtonsoft.Json.Silverlight"; TestsName = "Newtonsoft.Json.Tests.Silverlight"; Constants="SILVERLIGHT"; FinalDir="Silverlight"; Framework="net-2.0"},
@{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; Constants="NET20"; FinalDir="DotNet20"}, @{Name = "Newtonsoft.Json.Net20"; TestsName = "Newtonsoft.Json.Tests.Net20"; Constants="NET20"; FinalDir="DotNet20"; Framework="net-2.0"}
@{Name = "Newtonsoft.Json"; TestsName = "Newtonsoft.Json.Tests"; Constants=""; FinalDir="DotNet"}
) )
} }
$framework = '4.0x86'
task default -depends Test task default -depends Test
# Ensure a clean working directory # Ensure a clean working directory
@@ -101,6 +103,7 @@ task Test -depends Deploy {
{ {
$name = $build.TestsName $name = $build.TestsName
$finalDir = $build.FinalDir $finalDir = $build.FinalDir
$framework = $build.Framework
Write-Host -ForegroundColor Green "Copying test assembly $name to deployed directory" Write-Host -ForegroundColor Green "Copying test assembly $name to deployed directory"
Write-Host Write-Host
@@ -110,7 +113,7 @@ task Test -depends Deploy {
Write-Host -ForegroundColor Green "Running tests " $name Write-Host -ForegroundColor Green "Running tests " $name
Write-Host Write-Host
exec { .\Tools\NUnit\nunit-console.exe "$workingDir\Deployed\Bin\$finalDir\$name.dll" /xml:$workingDir\$name.xml } "Error running $name tests" exec { .\Tools\NUnit\nunit-console.exe "$workingDir\Deployed\Bin\$finalDir\$name.dll" /framework=$framework /xml:$workingDir\$name.xml } "Error running $name tests"
} }
} }
-31
View File
@@ -1,31 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Compact", "Newtonsoft.Json\Newtonsoft.Json.Compact.csproj", "{256AA604-F61B-4B6D-8D51-C8E6AB11E435}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{9ACB12BA-F27A-4BC4-A8C7-9A5B0DD02DF2}"
ProjectSection(SolutionItems) = preProject
Lib\NUnit\Compact\NUnitLite.dll = Lib\NUnit\Compact\NUnitLite.dll
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Tests.Compact", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.Compact.csproj", "{32EA9694-4FB3-43E9-A6AD-050F1D35EA0A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{256AA604-F61B-4B6D-8D51-C8E6AB11E435}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{256AA604-F61B-4B6D-8D51-C8E6AB11E435}.Debug|Any CPU.Build.0 = Debug|Any CPU
{256AA604-F61B-4B6D-8D51-C8E6AB11E435}.Release|Any CPU.ActiveCfg = Release|Any CPU
{256AA604-F61B-4B6D-8D51-C8E6AB11E435}.Release|Any CPU.Build.0 = Release|Any CPU
{32EA9694-4FB3-43E9-A6AD-050F1D35EA0A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{32EA9694-4FB3-43E9-A6AD-050F1D35EA0A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{32EA9694-4FB3-43E9-A6AD-050F1D35EA0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{32EA9694-4FB3-43E9-A6AD-050F1D35EA0A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+2 -2
View File
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008 # Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{620042D9-2753-48F5-BEDE-3905248781D2}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{620042D9-2753-48F5-BEDE-3905248781D2}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
Lib\LinqBridge.dll = Lib\LinqBridge.dll Lib\LinqBridge.dll = Lib\LinqBridge.dll
+2 -2
View File
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008 # Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{F69285DD-24FB-4A60-AE8B-4C2744285D0F}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{F69285DD-24FB-4A60-AE8B-4C2744285D0F}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
Lib\NUnit\Silverlight\nunit.framework.dll = Lib\NUnit\Silverlight\nunit.framework.dll Lib\NUnit\Silverlight\nunit.framework.dll = Lib\NUnit\Silverlight\nunit.framework.dll
+260 -185
View File
@@ -1,116 +1,150 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated from a template.
// Runtime Version:2.0.50727.3074
// //
// Changes to this file may cause incorrect behavior and will be lost if // Manual changes to this file may cause unexpected behavior in your application.
// the code is regenerated. // Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()] using System;
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DataServicesTestDatabaseModel", "FK_File_Folder", "Folder", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(Newtonsoft.Json.Tests.Folder), "File", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Newtonsoft.Json.Tests.File))] using System.Data.Objects;
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("DataServicesTestDatabaseModel", "FK_Folder_Folder", "Folder", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(Newtonsoft.Json.Tests.Folder), "Folder1", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Newtonsoft.Json.Tests.Folder))] using System.Data.Objects.DataClasses;
using System.Data.EntityClient;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;
[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata
[assembly: EdmRelationshipAttribute("DataServicesTestDatabaseModel", "FK_File_Folder", "Folder", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(Newtonsoft.Json.Tests.Folder), "File", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Newtonsoft.Json.Tests.File))]
[assembly: EdmRelationshipAttribute("DataServicesTestDatabaseModel", "FK_Folder_Folder", "Folder", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(Newtonsoft.Json.Tests.Folder), "Folder1", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(Newtonsoft.Json.Tests.Folder))]
#endregion
// Original file name:
// Generation date: 26/07/2009 4:51:53 p.m.
namespace Newtonsoft.Json.Tests namespace Newtonsoft.Json.Tests
{ {
#region Contexts
/// <summary> /// <summary>
/// There are no comments for DataServicesTestDatabaseEntities in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
public partial class DataServicesTestDatabaseEntities : global::System.Data.Objects.ObjectContext public partial class DataServicesTestDatabaseEntities : ObjectContext
{ {
#region Constructors
/// <summary> /// <summary>
/// Initializes a new DataServicesTestDatabaseEntities object using the connection string found in the 'DataServicesTestDatabaseEntities' section of the application configuration file. /// Initializes a new DataServicesTestDatabaseEntities object using the connection string found in the 'DataServicesTestDatabaseEntities' section of the application configuration file.
/// </summary> /// </summary>
public DataServicesTestDatabaseEntities() : public DataServicesTestDatabaseEntities() : base("name=DataServicesTestDatabaseEntities", "DataServicesTestDatabaseEntities")
base("name=DataServicesTestDatabaseEntities", "DataServicesTestDatabaseEntities")
{ {
this.OnContextCreated(); OnContextCreated();
} }
/// <summary> /// <summary>
/// Initialize a new DataServicesTestDatabaseEntities object. /// Initialize a new DataServicesTestDatabaseEntities object.
/// </summary> /// </summary>
public DataServicesTestDatabaseEntities(string connectionString) : public DataServicesTestDatabaseEntities(string connectionString) : base(connectionString, "DataServicesTestDatabaseEntities")
base(connectionString, "DataServicesTestDatabaseEntities")
{ {
this.OnContextCreated(); OnContextCreated();
} }
/// <summary> /// <summary>
/// Initialize a new DataServicesTestDatabaseEntities object. /// Initialize a new DataServicesTestDatabaseEntities object.
/// </summary> /// </summary>
public DataServicesTestDatabaseEntities(global::System.Data.EntityClient.EntityConnection connection) : public DataServicesTestDatabaseEntities(EntityConnection connection) : base(connection, "DataServicesTestDatabaseEntities")
base(connection, "DataServicesTestDatabaseEntities")
{ {
this.OnContextCreated(); OnContextCreated();
} }
#endregion
#region Partial Methods
partial void OnContextCreated(); partial void OnContextCreated();
#endregion
#region ObjectSet Properties
/// <summary> /// <summary>
/// There are no comments for File in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
public global::System.Data.Objects.ObjectQuery<File> File public ObjectSet<File> File
{ {
get get
{ {
if ((this._File == null)) if ((_File == null))
{ {
this._File = base.CreateQuery<File>("[File]"); _File = base.CreateObjectSet<File>("File");
} }
return this._File; return _File;
} }
} }
private global::System.Data.Objects.ObjectQuery<File> _File; private ObjectSet<File> _File;
/// <summary> /// <summary>
/// There are no comments for Folder in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
public global::System.Data.Objects.ObjectQuery<Folder> Folder public ObjectSet<Folder> Folder
{ {
get get
{ {
if ((this._Folder == null)) if ((_Folder == null))
{ {
this._Folder = base.CreateQuery<Folder>("[Folder]"); _Folder = base.CreateObjectSet<Folder>("Folder");
} }
return this._Folder; return _Folder;
} }
} }
private global::System.Data.Objects.ObjectQuery<Folder> _Folder; private ObjectSet<Folder> _Folder;
#endregion
#region AddTo Methods
/// <summary> /// <summary>
/// There are no comments for File in the schema. /// Deprecated Method for adding a new object to the File EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
/// </summary> /// </summary>
public void AddToFile(File file) public void AddToFile(File file)
{ {
base.AddObject("File", file); base.AddObject("File", file);
} }
/// <summary> /// <summary>
/// There are no comments for Folder in the schema. /// Deprecated Method for adding a new object to the Folder EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
/// </summary> /// </summary>
public void AddToFolder(Folder folder) public void AddToFolder(Folder folder)
{ {
base.AddObject("Folder", folder); base.AddObject("Folder", folder);
} }
#endregion
} }
#endregion
#region Entities
/// <summary> /// <summary>
/// There are no comments for DataServicesTestDatabaseModel.File in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
/// <KeyProperties> [EdmEntityTypeAttribute(NamespaceName="DataServicesTestDatabaseModel", Name="File")]
/// FileId [Serializable()]
/// </KeyProperties> [DataContractAttribute(IsReference=true)]
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DataServicesTestDatabaseModel", Name="File")] public partial class File : EntityObject
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
[global::System.Serializable()]
public partial class File : global::System.Data.Objects.DataClasses.EntityObject
{ {
#region Factory Method
/// <summary> /// <summary>
/// Create a new File object. /// Create a new File object.
/// </summary> /// </summary>
/// <param name="fileId">Initial value of FileId.</param> /// <param name="fileId">Initial value of the FileId property.</param>
/// <param name="name">Initial value of Name.</param> /// <param name="name">Initial value of the Name property.</param>
/// <param name="description">Initial value of Description.</param> /// <param name="description">Initial value of the Description property.</param>
/// <param name="createdDate">Initial value of CreatedDate.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param>
public static File CreateFile(global::System.Guid fileId, string name, string description, global::System.DateTime createdDate) public static File CreateFile(global::System.Guid fileId, global::System.String name, global::System.String description, global::System.DateTime createdDate)
{ {
File file = new File(); File file = new File();
file.FileId = fileId; file.FileId = fileId;
@@ -119,331 +153,372 @@ namespace Newtonsoft.Json.Tests
file.CreatedDate = createdDate; file.CreatedDate = createdDate;
return file; return file;
} }
#endregion
#region Primitive Properties
/// <summary> /// <summary>
/// There are no comments for Property FileId in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public global::System.Guid FileId public global::System.Guid FileId
{ {
get get
{ {
return this._FileId; return _FileId;
} }
set set
{ {
this.OnFileIdChanging(value); if (_FileId != value)
this.ReportPropertyChanging("FileId"); {
this._FileId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); OnFileIdChanging(value);
this.ReportPropertyChanged("FileId"); ReportPropertyChanging("FileId");
this.OnFileIdChanged(); _FileId = StructuralObject.SetValidValue(value);
ReportPropertyChanged("FileId");
OnFileIdChanged();
}
} }
} }
private global::System.Guid _FileId; private global::System.Guid _FileId;
partial void OnFileIdChanging(global::System.Guid value); partial void OnFileIdChanging(global::System.Guid value);
partial void OnFileIdChanged(); partial void OnFileIdChanged();
/// <summary> /// <summary>
/// There are no comments for Property Name in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public string Name public global::System.String Name
{ {
get get
{ {
return this._Name; return _Name;
} }
set set
{ {
this.OnNameChanging(value); OnNameChanging(value);
this.ReportPropertyChanging("Name"); ReportPropertyChanging("Name");
this._Name = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); _Name = StructuralObject.SetValidValue(value, false);
this.ReportPropertyChanged("Name"); ReportPropertyChanged("Name");
this.OnNameChanged(); OnNameChanged();
} }
} }
private string _Name; private global::System.String _Name;
partial void OnNameChanging(string value); partial void OnNameChanging(global::System.String value);
partial void OnNameChanged(); partial void OnNameChanged();
/// <summary> /// <summary>
/// There are no comments for Property Description in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public string Description public global::System.String Description
{ {
get get
{ {
return this._Description; return _Description;
} }
set set
{ {
this.OnDescriptionChanging(value); OnDescriptionChanging(value);
this.ReportPropertyChanging("Description"); ReportPropertyChanging("Description");
this._Description = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); _Description = StructuralObject.SetValidValue(value, false);
this.ReportPropertyChanged("Description"); ReportPropertyChanged("Description");
this.OnDescriptionChanged(); OnDescriptionChanged();
} }
} }
private string _Description; private global::System.String _Description;
partial void OnDescriptionChanging(string value); partial void OnDescriptionChanging(global::System.String value);
partial void OnDescriptionChanged(); partial void OnDescriptionChanged();
/// <summary> /// <summary>
/// There are no comments for Property CreatedDate in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public global::System.DateTime CreatedDate public global::System.DateTime CreatedDate
{ {
get get
{ {
return this._CreatedDate; return _CreatedDate;
} }
set set
{ {
this.OnCreatedDateChanging(value); OnCreatedDateChanging(value);
this.ReportPropertyChanging("CreatedDate"); ReportPropertyChanging("CreatedDate");
this._CreatedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); _CreatedDate = StructuralObject.SetValidValue(value);
this.ReportPropertyChanged("CreatedDate"); ReportPropertyChanged("CreatedDate");
this.OnCreatedDateChanged(); OnCreatedDateChanged();
} }
} }
private global::System.DateTime _CreatedDate; private global::System.DateTime _CreatedDate;
partial void OnCreatedDateChanging(global::System.DateTime value); partial void OnCreatedDateChanging(global::System.DateTime value);
partial void OnCreatedDateChanged(); partial void OnCreatedDateChanged();
#endregion
#region Navigation Properties
/// <summary> /// <summary>
/// There are no comments for Folder in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_File_Folder", "Folder")] [XmlIgnoreAttribute()]
[global::System.Xml.Serialization.XmlIgnoreAttribute()] [SoapIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()] [DataMemberAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_File_Folder", "Folder")]
public Folder Folder public Folder Folder
{ {
get get
{ {
return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder").Value; return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder").Value;
} }
set set
{ {
((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder").Value = value; ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder").Value = value;
} }
} }
/// <summary> /// <summary>
/// There are no comments for Folder in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.ComponentModel.BrowsableAttribute(false)] [BrowsableAttribute(false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public global::System.Data.Objects.DataClasses.EntityReference<Folder> FolderReference public EntityReference<Folder> FolderReference
{ {
get get
{ {
return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder"); return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder");
} }
set set
{ {
if ((value != null)) if ((value != null))
{ {
((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder", value); ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_File_Folder", "Folder", value);
} }
} }
} }
#endregion
} }
/// <summary> /// <summary>
/// There are no comments for DataServicesTestDatabaseModel.Folder in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
/// <KeyProperties> [EdmEntityTypeAttribute(NamespaceName="DataServicesTestDatabaseModel", Name="Folder")]
/// FolderId [Serializable()]
/// </KeyProperties> [DataContractAttribute(IsReference=true)]
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="DataServicesTestDatabaseModel", Name="Folder")] public partial class Folder : EntityObject
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
[global::System.Serializable()]
public partial class Folder : global::System.Data.Objects.DataClasses.EntityObject
{ {
#region Factory Method
/// <summary> /// <summary>
/// Create a new Folder object. /// Create a new Folder object.
/// </summary> /// </summary>
/// <param name="folderId">Initial value of FolderId.</param> /// <param name="folderId">Initial value of the FolderId property.</param>
/// <param name="name">Initial value of Name.</param> /// <param name="name">Initial value of the Name property.</param>
/// <param name="createdDate">Initial value of CreatedDate.</param> /// <param name="description">Initial value of the Description property.</param>
public static Folder CreateFolder(global::System.Guid folderId, string name, global::System.DateTime createdDate) /// <param name="createdDate">Initial value of the CreatedDate property.</param>
public static Folder CreateFolder(global::System.Guid folderId, global::System.String name, global::System.String description, global::System.DateTime createdDate)
{ {
Folder folder = new Folder(); Folder folder = new Folder();
folder.FolderId = folderId; folder.FolderId = folderId;
folder.Name = name; folder.Name = name;
folder.Description = description;
folder.CreatedDate = createdDate; folder.CreatedDate = createdDate;
return folder; return folder;
} }
#endregion
#region Primitive Properties
/// <summary> /// <summary>
/// There are no comments for Property FolderId in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)] [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public global::System.Guid FolderId public global::System.Guid FolderId
{ {
get get
{ {
return this._FolderId; return _FolderId;
} }
set set
{ {
this.OnFolderIdChanging(value); if (_FolderId != value)
this.ReportPropertyChanging("FolderId"); {
this._FolderId = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); OnFolderIdChanging(value);
this.ReportPropertyChanged("FolderId"); ReportPropertyChanging("FolderId");
this.OnFolderIdChanged(); _FolderId = StructuralObject.SetValidValue(value);
ReportPropertyChanged("FolderId");
OnFolderIdChanged();
}
} }
} }
private global::System.Guid _FolderId; private global::System.Guid _FolderId;
partial void OnFolderIdChanging(global::System.Guid value); partial void OnFolderIdChanging(global::System.Guid value);
partial void OnFolderIdChanged(); partial void OnFolderIdChanged();
/// <summary> /// <summary>
/// There are no comments for Property Name in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public string Name public global::System.String Name
{ {
get get
{ {
return this._Name; return _Name;
} }
set set
{ {
this.OnNameChanging(value); OnNameChanging(value);
this.ReportPropertyChanging("Name"); ReportPropertyChanging("Name");
this._Name = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false); _Name = StructuralObject.SetValidValue(value, false);
this.ReportPropertyChanged("Name"); ReportPropertyChanged("Name");
this.OnNameChanged(); OnNameChanged();
} }
} }
private string _Name; private global::System.String _Name;
partial void OnNameChanging(string value); partial void OnNameChanging(global::System.String value);
partial void OnNameChanged(); partial void OnNameChanged();
/// <summary> /// <summary>
/// There are no comments for Property Description in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()] [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public string Description public global::System.String Description
{ {
get get
{ {
return this._Description; return _Description;
} }
set set
{ {
this.OnDescriptionChanging(value); OnDescriptionChanging(value);
this.ReportPropertyChanging("Description"); ReportPropertyChanging("Description");
this._Description = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true); _Description = StructuralObject.SetValidValue(value, false);
this.ReportPropertyChanged("Description"); ReportPropertyChanged("Description");
this.OnDescriptionChanged(); OnDescriptionChanged();
} }
} }
private string _Description; private global::System.String _Description;
partial void OnDescriptionChanging(string value); partial void OnDescriptionChanging(global::System.String value);
partial void OnDescriptionChanged(); partial void OnDescriptionChanged();
/// <summary> /// <summary>
/// There are no comments for Property CreatedDate in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)] [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public global::System.DateTime CreatedDate public global::System.DateTime CreatedDate
{ {
get get
{ {
return this._CreatedDate; return _CreatedDate;
} }
set set
{ {
this.OnCreatedDateChanging(value); OnCreatedDateChanging(value);
this.ReportPropertyChanging("CreatedDate"); ReportPropertyChanging("CreatedDate");
this._CreatedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value); _CreatedDate = StructuralObject.SetValidValue(value);
this.ReportPropertyChanged("CreatedDate"); ReportPropertyChanged("CreatedDate");
this.OnCreatedDateChanged(); OnCreatedDateChanged();
} }
} }
private global::System.DateTime _CreatedDate; private global::System.DateTime _CreatedDate;
partial void OnCreatedDateChanging(global::System.DateTime value); partial void OnCreatedDateChanging(global::System.DateTime value);
partial void OnCreatedDateChanged(); partial void OnCreatedDateChanged();
#endregion
#region Navigation Properties
/// <summary> /// <summary>
/// There are no comments for Files in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_File_Folder", "File")] [XmlIgnoreAttribute()]
[global::System.Xml.Serialization.XmlIgnoreAttribute()] [SoapIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()] [DataMemberAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_File_Folder", "File")]
public global::System.Data.Objects.DataClasses.EntityCollection<File> Files public EntityCollection<File> Files
{ {
get get
{ {
return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<File>("DataServicesTestDatabaseModel.FK_File_Folder", "File"); return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<File>("DataServicesTestDatabaseModel.FK_File_Folder", "File");
} }
set set
{ {
if ((value != null)) if ((value != null))
{ {
((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<File>("DataServicesTestDatabaseModel.FK_File_Folder", "File", value); ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<File>("DataServicesTestDatabaseModel.FK_File_Folder", "File", value);
} }
} }
} }
/// <summary> /// <summary>
/// There are no comments for ChildFolders in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_Folder_Folder", "Folder1")] [XmlIgnoreAttribute()]
[global::System.Xml.Serialization.XmlIgnoreAttribute()] [SoapIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()] [DataMemberAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_Folder_Folder", "Folder1")]
public global::System.Data.Objects.DataClasses.EntityCollection<Folder> ChildFolders public EntityCollection<Folder> ChildFolders
{ {
get get
{ {
return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder1"); return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder1");
} }
set set
{ {
if ((value != null)) if ((value != null))
{ {
((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder1", value); ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder1", value);
} }
} }
} }
/// <summary> /// <summary>
/// There are no comments for ParentFolder in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_Folder_Folder", "Folder")] [XmlIgnoreAttribute()]
[global::System.Xml.Serialization.XmlIgnoreAttribute()] [SoapIgnoreAttribute()]
[global::System.Xml.Serialization.SoapIgnoreAttribute()] [DataMemberAttribute()]
[global::System.Runtime.Serialization.DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("DataServicesTestDatabaseModel", "FK_Folder_Folder", "Folder")]
public Folder ParentFolder public Folder ParentFolder
{ {
get get
{ {
return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder").Value; return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder").Value;
} }
set set
{ {
((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder").Value = value; ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder").Value = value;
} }
} }
/// <summary> /// <summary>
/// There are no comments for ParentFolder in the schema. /// No Metadata Documentation available.
/// </summary> /// </summary>
[global::System.ComponentModel.BrowsableAttribute(false)] [BrowsableAttribute(false)]
[global::System.Runtime.Serialization.DataMemberAttribute()] [DataMemberAttribute()]
public global::System.Data.Objects.DataClasses.EntityReference<Folder> ParentFolderReference public EntityReference<Folder> ParentFolderReference
{ {
get get
{ {
return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder"); return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder");
} }
set set
{ {
if ((value != null)) if ((value != null))
{ {
((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder", value); ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Folder>("DataServicesTestDatabaseModel.FK_Folder_Folder", "Folder", value);
} }
} }
} }
#endregion
} }
#endregion
} }
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
<!-- EF Runtime content --> <!-- EF Runtime content -->
<edmx:Runtime> <edmx:Runtime>
<!-- SSDL content --> <!-- SSDL content -->
<edmx:StorageModels> <edmx:StorageModels>
<Schema Namespace="DataServicesTestDatabaseModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> <Schema Namespace="DataServicesTestDatabaseModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
<EntityContainer Name="DataServicesTestDatabaseModelStoreContainer"> <EntityContainer Name="DataServicesTestDatabaseModelStoreContainer">
<EntitySet Name="File" EntityType="DataServicesTestDatabaseModel.Store.File" store:Type="Tables" Schema="dbo" /> <EntitySet Name="File" EntityType="DataServicesTestDatabaseModel.Store.File" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
<EntitySet Name="Folder" EntityType="DataServicesTestDatabaseModel.Store.Folder" store:Type="Tables" Schema="dbo" /> <EntitySet Name="Folder" EntityType="DataServicesTestDatabaseModel.Store.Folder" store:Type="Tables" Schema="dbo" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
<AssociationSet Name="FK_File_Folder" Association="DataServicesTestDatabaseModel.Store.FK_File_Folder"> <AssociationSet Name="FK_File_Folder" Association="DataServicesTestDatabaseModel.Store.FK_File_Folder">
<End Role="Folder" EntitySet="Folder" /> <End Role="Folder" EntitySet="Folder" />
<End Role="File" EntitySet="File" /> <End Role="File" EntitySet="File" />
@@ -65,7 +65,7 @@
</edmx:StorageModels> </edmx:StorageModels>
<!-- CSDL content --> <!-- CSDL content -->
<edmx:ConceptualModels> <edmx:ConceptualModels>
<Schema Namespace="DataServicesTestDatabaseModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm"> <Schema Namespace="DataServicesTestDatabaseModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="DataServicesTestDatabaseEntities"> <EntityContainer Name="DataServicesTestDatabaseEntities">
<EntitySet Name="File" EntityType="DataServicesTestDatabaseModel.File" /> <EntitySet Name="File" EntityType="DataServicesTestDatabaseModel.File" />
<EntitySet Name="Folder" EntityType="DataServicesTestDatabaseModel.Folder" /> <EntitySet Name="Folder" EntityType="DataServicesTestDatabaseModel.Folder" />
@@ -112,7 +112,7 @@
</edmx:ConceptualModels> </edmx:ConceptualModels>
<!-- C-S mapping content --> <!-- C-S mapping content -->
<edmx:Mappings> <edmx:Mappings>
<Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS"> <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
<EntityContainerMapping StorageEntityContainer="DataServicesTestDatabaseModelStoreContainer" CdmEntityContainer="DataServicesTestDatabaseEntities"> <EntityContainerMapping StorageEntityContainer="DataServicesTestDatabaseModelStoreContainer" CdmEntityContainer="DataServicesTestDatabaseEntities">
<EntitySetMapping Name="File"> <EntitySetMapping Name="File">
<EntityTypeMapping TypeName="IsTypeOf(DataServicesTestDatabaseModel.File)"> <EntityTypeMapping TypeName="IsTypeOf(DataServicesTestDatabaseModel.File)">
@@ -156,20 +156,20 @@
</edmx:Mappings> </edmx:Mappings>
</edmx:Runtime> </edmx:Runtime>
<!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) --> <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
<edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:Designer>
<edmx:Connection> <edmx:Connection>
<DesignerInfoPropertySet> <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
<DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" /> <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
</DesignerInfoPropertySet> </DesignerInfoPropertySet>
</edmx:Connection> </edmx:Connection>
<edmx:Options> <edmx:Options>
<DesignerInfoPropertySet> <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
<DesignerProperty Name="ValidateOnBuild" Value="true" /> <DesignerProperty Name="ValidateOnBuild" Value="true" />
</DesignerInfoPropertySet> </DesignerInfoPropertySet>
</edmx:Options> </edmx:Options>
<!-- Diagram content (shape and connector positions) --> <!-- Diagram content (shape and connector positions) -->
<edmx:Diagrams> <edmx:Diagrams>
<Diagram Name="FileSystemEntityModel"> <Diagram Name="FileSystemEntityModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
<EntityTypeShape EntityType="DataServicesTestDatabaseModel.File" Width="1.5" PointX="3" PointY="1.125" Height="1.9802864583333335" IsExpanded="true" /> <EntityTypeShape EntityType="DataServicesTestDatabaseModel.File" Width="1.5" PointX="3" PointY="1.125" Height="1.9802864583333335" IsExpanded="true" />
<EntityTypeShape EntityType="DataServicesTestDatabaseModel.Folder" Width="1.5" PointX="0.75" PointY="1" Height="2.3648893229166665" IsExpanded="true" /> <EntityTypeShape EntityType="DataServicesTestDatabaseModel.Folder" Width="1.5" PointX="0.75" PointY="1" Height="2.3648893229166665" IsExpanded="true" />
<AssociationConnector Association="DataServicesTestDatabaseModel.FK_File_Folder" ManuallyRouted="false"> <AssociationConnector Association="DataServicesTestDatabaseModel.FK_File_Folder" ManuallyRouted="false">
@@ -1,49 +0,0 @@
#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !PocketPC && !SILVERLIGHT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Newtonsoft.Json.Linq;
using System.ComponentModel;
using Newtonsoft.Json.Linq.ComponentModel;
namespace Newtonsoft.Json.Tests.Linq.ComponentModel
{
public class JTypeDescriptionProviderTests : TestFixtureBase
{
[Test]
public void GetTypeDescriptor()
{
JTypeDescriptionProvider provider = new JTypeDescriptionProvider();
JTypeDescriptor descriptor = (JTypeDescriptor)provider.GetTypeDescriptor(typeof (JObject), new JObject());
Assert.IsNotNull(descriptor);
}
}
}
#endif
@@ -1,80 +0,0 @@
#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !SILVERLIGHT
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq.ComponentModel;
using NUnit.Framework;
using Newtonsoft.Json.Linq;
using System.ComponentModel;
namespace Newtonsoft.Json.Tests.Linq.ComponentModel
{
public class JTypeDescriptorTests : TestFixtureBase
{
[Test]
public void GetProperties()
{
JObject o = JObject.Parse("{'prop1':12,'prop2':'hi!','prop3':null,'prop4':[1,2,3]}");
JTypeDescriptor descriptor = new JTypeDescriptor(o);
PropertyDescriptorCollection properties = descriptor.GetProperties();
Assert.AreEqual(4, properties.Count);
PropertyDescriptor prop1 = properties[0];
Assert.AreEqual("prop1", prop1.Name);
Assert.AreEqual(typeof(long), prop1.PropertyType);
Assert.AreEqual(typeof(JObject), prop1.ComponentType);
Assert.AreEqual(false, prop1.CanResetValue(o));
Assert.AreEqual(false, prop1.ShouldSerializeValue(o));
PropertyDescriptor prop2 = properties[1];
Assert.AreEqual("prop2", prop2.Name);
Assert.AreEqual(typeof(string), prop2.PropertyType);
Assert.AreEqual(typeof(JObject), prop2.ComponentType);
Assert.AreEqual(false, prop2.CanResetValue(o));
Assert.AreEqual(false, prop2.ShouldSerializeValue(o));
PropertyDescriptor prop3 = properties[2];
Assert.AreEqual("prop3", prop3.Name);
Assert.AreEqual(typeof(object), prop3.PropertyType);
Assert.AreEqual(typeof(JObject), prop3.ComponentType);
Assert.AreEqual(false, prop3.CanResetValue(o));
Assert.AreEqual(false, prop3.ShouldSerializeValue(o));
PropertyDescriptor prop4 = properties[3];
Assert.AreEqual("prop4", prop4.Name);
Assert.AreEqual(typeof(JArray), prop4.PropertyType);
Assert.AreEqual(typeof(JObject), prop4.ComponentType);
Assert.AreEqual(false, prop4.CanResetValue(o));
Assert.AreEqual(false, prop4.ShouldSerializeValue(o));
}
}
}
#endif
@@ -1488,5 +1488,46 @@ Parameter name: arrayIndex")]
JObject.Parse(json); JObject.Parse(json);
} }
#if !SILVERLIGHT
[Test]
public void GetProperties()
{
JObject o = JObject.Parse("{'prop1':12,'prop2':'hi!','prop3':null,'prop4':[1,2,3]}");
ICustomTypeDescriptor descriptor = o;
PropertyDescriptorCollection properties = descriptor.GetProperties();
Assert.AreEqual(4, properties.Count);
PropertyDescriptor prop1 = properties[0];
Assert.AreEqual("prop1", prop1.Name);
Assert.AreEqual(typeof(long), prop1.PropertyType);
Assert.AreEqual(typeof(JObject), prop1.ComponentType);
Assert.AreEqual(false, prop1.CanResetValue(o));
Assert.AreEqual(false, prop1.ShouldSerializeValue(o));
PropertyDescriptor prop2 = properties[1];
Assert.AreEqual("prop2", prop2.Name);
Assert.AreEqual(typeof(string), prop2.PropertyType);
Assert.AreEqual(typeof(JObject), prop2.ComponentType);
Assert.AreEqual(false, prop2.CanResetValue(o));
Assert.AreEqual(false, prop2.ShouldSerializeValue(o));
PropertyDescriptor prop3 = properties[2];
Assert.AreEqual("prop3", prop3.Name);
Assert.AreEqual(typeof(object), prop3.PropertyType);
Assert.AreEqual(typeof(JObject), prop3.ComponentType);
Assert.AreEqual(false, prop3.CanResetValue(o));
Assert.AreEqual(false, prop3.ShouldSerializeValue(o));
PropertyDescriptor prop4 = properties[3];
Assert.AreEqual("prop4", prop4.Name);
Assert.AreEqual(typeof(JArray), prop4.PropertyType);
Assert.AreEqual(typeof(JObject), prop4.ComponentType);
Assert.AreEqual(false, prop4.CanResetValue(o));
Assert.AreEqual(false, prop4.ShouldSerializeValue(o));
}
#endif
} }
} }
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.3074 // Runtime Version:4.0.30319.1
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -100,7 +100,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Table(Name="")] [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
public partial class Person : INotifyPropertyChanging, INotifyPropertyChanged public partial class Person : INotifyPropertyChanging, INotifyPropertyChanged
{ {
@@ -139,7 +139,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
OnCreated(); OnCreated();
} }
[Column(Storage="_FirstName", CanBeNull=false)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FirstName", CanBeNull=false)]
public string FirstName public string FirstName
{ {
get get
@@ -159,7 +159,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Column(Storage="_LastName", CanBeNull=false)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_LastName", CanBeNull=false)]
public string LastName public string LastName
{ {
get get
@@ -179,7 +179,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Column(Storage="_PersonId", IsPrimaryKey=true)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PersonId", IsPrimaryKey=true)]
public System.Guid PersonId public System.Guid PersonId
{ {
get get
@@ -199,7 +199,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Column(Storage="_DepartmentId")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartmentId")]
public System.Guid DepartmentId public System.Guid DepartmentId
{ {
get get
@@ -223,7 +223,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Association(Name="Person_PersonRole", Storage="_PersonRoles", ThisKey="PersonId", OtherKey="PersonId")] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Person_PersonRole", Storage="_PersonRoles", ThisKey="PersonId", OtherKey="PersonId")]
public EntitySet<PersonRole> PersonRoles public EntitySet<PersonRole> PersonRoles
{ {
get get
@@ -236,7 +236,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Association(Name="Department_Person", Storage="_Department", ThisKey="DepartmentId", OtherKey="DepartmentId", IsForeignKey=true)] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Department_Person", Storage="_Department", ThisKey="DepartmentId", OtherKey="DepartmentId", IsForeignKey=true)]
public Department Department public Department Department
{ {
get get
@@ -303,7 +303,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Table(Name="")] [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
public partial class Role : INotifyPropertyChanging, INotifyPropertyChanged public partial class Role : INotifyPropertyChanging, INotifyPropertyChanged
{ {
@@ -331,7 +331,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
OnCreated(); OnCreated();
} }
[Column(Storage="_Name", CanBeNull=false)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", CanBeNull=false)]
public string Name public string Name
{ {
get get
@@ -351,7 +351,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Column(Storage="_RoleId", IsPrimaryKey=true)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RoleId", IsPrimaryKey=true)]
public System.Guid RoleId public System.Guid RoleId
{ {
get get
@@ -371,7 +371,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Association(Name="Role_PersonRole", Storage="_PersonRoles", ThisKey="RoleId", OtherKey="RoleId")] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Role_PersonRole", Storage="_PersonRoles", ThisKey="RoleId", OtherKey="RoleId")]
public EntitySet<PersonRole> PersonRoles public EntitySet<PersonRole> PersonRoles
{ {
get get
@@ -417,7 +417,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Table(Name="")] [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
public partial class PersonRole : INotifyPropertyChanging, INotifyPropertyChanged public partial class PersonRole : INotifyPropertyChanging, INotifyPropertyChanged
{ {
@@ -452,7 +452,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
OnCreated(); OnCreated();
} }
[Column(Storage="_PersonId")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PersonId")]
public System.Guid PersonId public System.Guid PersonId
{ {
get get
@@ -476,7 +476,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Column(Storage="_RoleId")] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_RoleId")]
public System.Guid RoleId public System.Guid RoleId
{ {
get get
@@ -500,7 +500,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Column(Storage="_PersonRoleId", IsPrimaryKey=true)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_PersonRoleId", IsPrimaryKey=true)]
public System.Guid PersonRoleId public System.Guid PersonRoleId
{ {
get get
@@ -520,7 +520,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Association(Name="Person_PersonRole", Storage="_Person", ThisKey="PersonId", OtherKey="PersonId", IsForeignKey=true)] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Person_PersonRole", Storage="_Person", ThisKey="PersonId", OtherKey="PersonId", IsForeignKey=true)]
public Person Person public Person Person
{ {
get get
@@ -554,7 +554,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Association(Name="Role_PersonRole", Storage="_Role", ThisKey="RoleId", OtherKey="RoleId", IsForeignKey=true)] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Role_PersonRole", Storage="_Role", ThisKey="RoleId", OtherKey="RoleId", IsForeignKey=true)]
public Role Role public Role Role
{ {
get get
@@ -609,7 +609,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Table(Name="")] [global::System.Data.Linq.Mapping.TableAttribute(Name="")]
public partial class Department : INotifyPropertyChanging, INotifyPropertyChanged public partial class Department : INotifyPropertyChanging, INotifyPropertyChanged
{ {
@@ -637,7 +637,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
OnCreated(); OnCreated();
} }
[Column(Storage="_DepartmentId", IsPrimaryKey=true)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_DepartmentId", IsPrimaryKey=true)]
public System.Guid DepartmentId public System.Guid DepartmentId
{ {
get get
@@ -657,7 +657,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Column(Storage="_Name", CanBeNull=false)] [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Name", CanBeNull=false)]
public string Name public string Name
{ {
get get
@@ -677,7 +677,7 @@ namespace Newtonsoft.Json.Tests.LinqToSql
} }
} }
[Association(Name="Department_Person", Storage="_Persons", ThisKey="DepartmentId", OtherKey="DepartmentId")] [global::System.Data.Linq.Mapping.AssociationAttribute(Name="Department_Person", Storage="_Persons", ThisKey="DepartmentId", OtherKey="DepartmentId")]
public EntitySet<Person> Persons public EntitySet<Person> Persons
{ {
get get
@@ -1,229 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{32EA9694-4FB3-43E9-A6AD-050F1D35EA0A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json.Tests</RootNamespace>
<AssemblyName>Newtonsoft.Json.Tests.Compact</AssemblyName>
<ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PlatformFamilyName>PocketPC</PlatformFamilyName>
<PlatformID>b2c48bd2-963d-4549-9169-1fa021dce484</PlatformID>
<OSVersion>5.2</OSVersion>
<DeployDirSuffix>Newtonsoft.Json.Tests.Compact</DeployDirSuffix>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<NativePlatformName>Windows Mobile 6 Professional SDK</NativePlatformName>
<FormFactorID>
</FormFactorID>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\Compact\</OutputPath>
<DefineConstants>TRACE;DEBUG;PocketPC</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<FileAlignment>512</FileAlignment>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\Compact\</OutputPath>
<DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<FileAlignment>512</FileAlignment>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="NUnitLite, Version=0.2.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\NUnit\Compact\NUnitLite.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bson\BsonReaderTests.cs" />
<Compile Include="Bson\BsonWriterTests.cs" />
<Compile Include="Converters\BinaryConverterTests.cs" />
<Compile Include="Converters\CustomCreationConverterTests.cs" />
<Compile Include="Converters\DataSetConverterTests.cs" />
<Compile Include="Converters\DataTableConverterTests.cs" />
<Compile Include="Converters\ObjectIdConverterTests.cs" />
<Compile Include="Converters\RegexConverterTests.cs" />
<Compile Include="Converters\StringEnumConverterTests.cs" />
<Compile Include="Linq\ComponentModel\BindingTests.cs" />
<Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptionProviderTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptorTests.cs" />
<Compile Include="Linq\JPathTests.cs" />
<Compile Include="Linq\JRawTests.cs" />
<Compile Include="Linq\JTokenReaderTest.cs" />
<Compile Include="Linq\JTokenWriterTest.cs" />
<Compile Include="JsonValidatingReaderTests.cs" />
<Compile Include="Schema\ExtensionsTests.cs" />
<Compile Include="Schema\JsonSchemaModelBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaNodeTests.cs" />
<Compile Include="Serialization\CamelCasePropertyNamesContractResolverTests.cs" />
<Compile Include="Serialization\ConstructorHandlingTests.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
<Compile Include="Serialization\JsonSerializerTest.cs" />
<Compile Include="Serialization\MissingMemberHandlingTests.cs" />
<Compile Include="Serialization\PopulateTests.cs" />
<Compile Include="Serialization\PreserveReferencesHandlingTests.cs" />
<Compile Include="Serialization\SerializationErrorHandlingTests.cs" />
<Compile Include="Serialization\SerializationEventAttributeTests.cs" />
<Compile Include="Serialization\TypeNameHandlingTests.cs" />
<Compile Include="TestObjects\AbstractGenericBase.cs" />
<Compile Include="TestObjects\ArgumentConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\BadJsonPropertyClass.cs" />
<Compile Include="TestObjects\Bar.cs" />
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\CircularReferenceClass.cs" />
<Compile Include="TestObjects\ClassAndMemberConverterClass.cs" />
<Compile Include="TestObjects\ClassConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConstructorCaseSensitivityClass.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
<Compile Include="TestObjects\Content.cs" />
<Compile Include="TestObjects\ContentBaseClass.cs" />
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\ConverterPrecedenceClass.cs" />
<Compile Include="TestObjects\ConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\CircularReferenceWithIdClass.cs" />
<Compile Include="TestObjects\DateTimeErrorObjectCollection.cs" />
<Compile Include="TestObjects\DefaultValueAttributeTestClass.cs" />
<Compile Include="TestObjects\DictionaryInterfaceClass.cs" />
<Compile Include="TestObjects\DoubleClass.cs" />
<Compile Include="TestObjects\EmployeeReference.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GenericImpl.cs" />
<Compile Include="TestObjects\GenericListAndDictionaryInterfaceProperties.cs" />
<Compile Include="TestObjects\GetOnlyPropertyClass.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IncompatibleJsonAttributeClass.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\Invoice.cs" />
<Compile Include="TestObjects\JaggedArray.cs" />
<Compile Include="TestObjects\JsonIgnoreAttributeTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
<Compile Include="TestObjects\JsonPropertyWithHandlingValues.cs" />
<Compile Include="TestObjects\ListErrorObject.cs" />
<Compile Include="TestObjects\ListErrorObjectCollection.cs" />
<Compile Include="TestObjects\ListOfIds.cs" />
<Compile Include="TestObjects\ListTestClass.cs" />
<Compile Include="TestObjects\LogEntry.cs" />
<Compile Include="TestObjects\MemberConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\MethodExecutorObject.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyClass.cs" />
<Compile Include="TestObjects\Name.cs" />
<Compile Include="TestObjects\NonRequest.cs" />
<Compile Include="TestObjects\NullableDateTimeTestClass.cs" />
<Compile Include="TestObjects\ObjectArrayPropertyTest.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PersonRaw.cs" />
<Compile Include="TestObjects\PhoneNumber.cs" />
<Compile Include="TestObjects\PrivateConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateConstructorWithPublicParametizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateMembersClass.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RequiredMembersClass.cs" />
<Compile Include="TestObjects\RoleTransfer.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SerializationEventTestDictionary.cs" />
<Compile Include="TestObjects\SerializationEventTestList.cs" />
<Compile Include="TestObjects\SerializationEventTestObject.cs" />
<Compile Include="TestObjects\SerializationEventTestObjectWithConstructor.cs" />
<Compile Include="TestObjects\SetOnlyPropertyClass.cs" />
<Compile Include="TestObjects\Article.cs" />
<Compile Include="TestObjects\ArticleCollection.cs" />
<Compile Include="TestObjects\ClassWithArray.cs" />
<Compile Include="TestObjects\ClassWithGuid.cs" />
<Compile Include="TestObjects\ConverableMembers.cs" />
<Compile Include="TestObjects\JsonIgnoreAttributeOnClassTestClass.cs" />
<Compile Include="Linq\JConstructorTests.cs" />
<Compile Include="Linq\JPropertyTests.cs" />
<Compile Include="TestObjects\MemberConverterClass.cs" />
<Compile Include="TestObjects\Product.cs" />
<Compile Include="TestObjects\ProductCollection.cs" />
<Compile Include="TestObjects\ProductShort.cs" />
<Compile Include="TestObjects\SetOnlyPropertyClass2.cs" />
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\Store.cs" />
<Compile Include="TestObjects\StoreColor.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="Schema\JsonSchemaBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaGeneratorTests.cs" />
<Compile Include="Schema\JsonSchemaTests.cs" />
<Compile Include="TestObjects\DateTimeTestClass.cs" />
<Compile Include="Converters\IsoDateTimeConverterTests.cs" />
<Compile Include="JsonConvertTest.cs" />
<Compile Include="Converters\JavaScriptDateTimeConverterTests.cs" />
<Compile Include="JsonTextReaderTest.cs" />
<Compile Include="JsonTextWriterTest.cs" />
<Compile Include="Linq\JArrayTests.cs" />
<Compile Include="Linq\JObjectTests.cs" />
<Compile Include="Linq\JTokenEqualityComparerTests.cs" />
<Compile Include="Linq\JTokenTests.cs" />
<Compile Include="Linq\JValueTests.cs" />
<Compile Include="Linq\LinqToJsonTest.cs" />
<Compile Include="PerformanceTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SilverlightTests.cs" />
<Compile Include="TestFixtureBase.cs" />
<Compile Include="Converters\XmlNodeConverterTest.cs" />
<Compile Include="TestObjects\StructTest.cs" />
<Compile Include="TestObjects\SubKlass.cs" />
<Compile Include="TestObjects\SuperKlass.cs" />
<Compile Include="TestObjects\TypeClass.cs" />
<Compile Include="TestObjects\TypedSubHashtable.cs" />
<Compile Include="TestObjects\UserNullable.cs" />
<Compile Include="TestObjects\VersionKeyedCollection.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="Utilities\DynamicReflectionDelegateFactoryTests.cs" />
<Compile Include="Utilities\ReflectionUtilsTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Newtonsoft.Json\Newtonsoft.Json.Compact.csproj">
<Project>{256AA604-F61B-4B6D-8D51-C8E6AB11E435}</Project>
<Name>Newtonsoft.Json.Compact</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
<HostingProcess disable="1" />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -19,15 +20,28 @@
</SccProvider> </SccProvider>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<SignAssembly>false</SignAssembly> <SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile> </AssemblyOriginatorKeyFile>
<TargetFrameworkSubset> <PublishUrl>publish\</PublishUrl>
</TargetFrameworkSubset> <Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -37,6 +51,7 @@
<DefineConstants>TRACE;DEBUG;NET20</DefineConstants> <DefineConstants>TRACE;DEBUG;NET20</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -45,6 +60,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="LinqBridge, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c2b14eb747628076, processorArchitecture=MSIL"> <Reference Include="LinqBridge, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c2b14eb747628076, processorArchitecture=MSIL">
@@ -77,8 +93,6 @@
<Compile Include="JsonValidatingReaderTests.cs" /> <Compile Include="JsonValidatingReaderTests.cs" />
<Compile Include="Linq\ComponentModel\BindingTests.cs" /> <Compile Include="Linq\ComponentModel\BindingTests.cs" />
<Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" /> <Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptionProviderTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptorTests.cs" />
<Compile Include="Linq\JPathTests.cs" /> <Compile Include="Linq\JPathTests.cs" />
<Compile Include="Linq\JRawTests.cs" /> <Compile Include="Linq\JRawTests.cs" />
<Compile Include="Serialization\ConstructorHandlingTests.cs" /> <Compile Include="Serialization\ConstructorHandlingTests.cs" />
@@ -220,6 +234,23 @@
<Name>Newtonsoft.Json.Net20</Name> <Name>Newtonsoft.Json.Net20</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
@@ -1,4 +1,8 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,13 +14,32 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json.Tests.Silverlight</RootNamespace> <RootNamespace>Newtonsoft.Json.Tests.Silverlight</RootNamespace>
<AssemblyName>Newtonsoft.Json.Tests.Silverlight</AssemblyName> <AssemblyName>Newtonsoft.Json.Tests.Silverlight</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<SilverlightApplication>false</SilverlightApplication> <SilverlightApplication>false</SilverlightApplication>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<SignManifests>false</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -28,6 +51,7 @@
<NoConfig>true</NoConfig> <NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -38,6 +62,7 @@
<NoConfig>true</NoConfig> <NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="nunit.framework, Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=2.4.7.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
@@ -81,8 +106,6 @@
<Compile Include="JsonArrayAttributeTests.cs" /> <Compile Include="JsonArrayAttributeTests.cs" />
<Compile Include="Linq\ComponentModel\BindingTests.cs" /> <Compile Include="Linq\ComponentModel\BindingTests.cs" />
<Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" /> <Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptionProviderTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptorTests.cs" />
<Compile Include="Linq\JPathTests.cs" /> <Compile Include="Linq\JPathTests.cs" />
<Compile Include="Linq\JRawTests.cs" /> <Compile Include="Linq\JRawTests.cs" />
<Compile Include="Linq\JTokenReaderTest.cs" /> <Compile Include="Linq\JTokenReaderTest.cs" />
@@ -222,7 +245,24 @@
<Name>Newtonsoft.Json.Silverlight</Name> <Name>Newtonsoft.Json.Silverlight</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" /> <ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
@@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -19,13 +20,30 @@
</SccProvider> </SccProvider>
<FileUpgradeFlags> <FileUpgradeFlags>
</FileUpgradeFlags> </FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SignAssembly>false</SignAssembly> <SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile> <AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile> </AssemblyOriginatorKeyFile>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -35,6 +53,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -43,6 +62,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
@@ -114,8 +134,6 @@
<Compile Include="LinqToSql\Person.cs" /> <Compile Include="LinqToSql\Person.cs" />
<Compile Include="Linq\ComponentModel\BindingTests.cs" /> <Compile Include="Linq\ComponentModel\BindingTests.cs" />
<Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" /> <Compile Include="Linq\ComponentModel\JPropertyDescriptorTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptionProviderTests.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptorTests.cs" />
<Compile Include="Linq\JPathTests.cs" /> <Compile Include="Linq\JPathTests.cs" />
<Compile Include="Linq\JRawTests.cs" /> <Compile Include="Linq\JRawTests.cs" />
<Compile Include="Serialization\ConstructorHandlingTests.cs" /> <Compile Include="Serialization\ConstructorHandlingTests.cs" />
@@ -281,6 +299,23 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
@@ -60,55 +60,6 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("Error message for member 1 = An item with the same key has already been added.", c.Messages[0]); Assert.AreEqual("Error message for member 1 = An item with the same key has already been added.", c.Messages[0]);
} }
[Test]
public void ErrorSerializingListHandled()
{
VersionKeyedCollection c = new VersionKeyedCollection();
c.Add(new Person
{
Name = "Jim",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
c.Add(new Person
{
Name = "Jimbo",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
c.Add(new Person
{
Name = "Jimmy",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
c.Add(new Person
{
Name = "Jim Bean",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
string json = JsonConvert.SerializeObject(c, Formatting.Indented);
Assert.AreEqual(@"[
{
""Name"": ""Jimbo"",
""BirthDate"": ""\/Date(978048000000)\/"",
""LastModified"": ""\/Date(978048000000)\/""
},
{
""Name"": ""Jim Bean"",
""BirthDate"": ""\/Date(978048000000)\/"",
""LastModified"": ""\/Date(978048000000)\/""
}
]", json);
Assert.AreEqual(2, c.Messages.Count);
Assert.AreEqual("Error message for member 0 = Index even: 0", c.Messages[0]);
Assert.AreEqual("Error message for member 2 = Index even: 2", c.Messages[1]);
}
[Test] [Test]
public void DeserializingErrorInChildObject() public void DeserializingErrorInChildObject()
{ {
@@ -244,7 +195,11 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(new DateTime(2000, 12, 1, 0, 0, 0, DateTimeKind.Utc), c[2]); Assert.AreEqual(new DateTime(2000, 12, 1, 0, 0, 0, DateTimeKind.Utc), c[2]);
Assert.AreEqual(3, errors.Count); Assert.AreEqual(3, errors.Count);
#if !(NET20 || SILVERLIGHT)
Assert.AreEqual("The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.", errors[0]);
#else
Assert.AreEqual("The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.", errors[0]); Assert.AreEqual("The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.", errors[0]);
#endif
Assert.AreEqual("Unexpected token parsing date. Expected String, got StartArray.", errors[1]); Assert.AreEqual("Unexpected token parsing date. Expected String, got StartArray.", errors[1]);
Assert.AreEqual("Cannot convert null value to System.DateTime.", errors[2]); Assert.AreEqual("Cannot convert null value to System.DateTime.", errors[2]);
} }
@@ -319,7 +319,7 @@ namespace Newtonsoft.Json.Tests.Serialization
public void SerializeObjectWithMultipleGenericLists() public void SerializeObjectWithMultipleGenericLists()
{ {
string containerTypeName = typeof(Container).AssemblyQualifiedName; string containerTypeName = typeof(Container).AssemblyQualifiedName;
string productTypeName = typeof(Product).AssemblyQualifiedName; string productListTypeName = typeof(List<Product>).AssemblyQualifiedName;
Container container = new Container Container container = new Container
{ {
@@ -338,11 +338,11 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(@"{ Assert.AreEqual(@"{
""$type"": """ + containerTypeName + @""", ""$type"": """ + containerTypeName + @""",
""In"": { ""In"": {
""$type"": ""System.Collections.Generic.List`1[[" + productTypeName + @"]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"", ""$type"": """ + productListTypeName + @""",
""$values"": [] ""$values"": []
}, },
""Out"": { ""Out"": {
""$type"": ""System.Collections.Generic.List`1[[" + productTypeName + @"]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"", ""$type"": """ + productListTypeName + @""",
""$values"": [] ""$values"": []
} }
}", json); }", json);
@@ -33,7 +33,7 @@ using Newtonsoft.Json.Tests.TestObjects;
namespace Newtonsoft.Json.Tests.TestObjects namespace Newtonsoft.Json.Tests.TestObjects
{ {
public class VersionKeyedCollection : KeyedCollection<string, Person>, IList public class VersionKeyedCollection : KeyedCollection<string, Person>, IEnumerable<Person>
{ {
public List<string> Messages { get; set; } public List<string> Messages { get; set; }
@@ -54,16 +54,20 @@ namespace Newtonsoft.Json.Tests.TestObjects
errorContext.Handled = true; errorContext.Handled = true;
} }
object IList.this[int index] IEnumerator<Person> IEnumerable<Person>.GetEnumerator()
{ {
get for (int i = 0; i < Count; i++)
{ {
if (index % 2 == 0) if (i % 2 == 0)
throw new Exception("Index even: " + index); throw new Exception("Index even: " + i);
return this[index]; yield return this[i];
} }
set { this[index] = (Person)value; } }
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<Person>) this).GetEnumerator();
} }
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008 # Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{620042D9-2753-48F5-BEDE-3905248781D2}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{620042D9-2753-48F5-BEDE-3905248781D2}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
Lib\NUnit\DotNet\nunit.framework.dll = Lib\NUnit\DotNet\nunit.framework.dll Lib\NUnit\DotNet\nunit.framework.dll = Lib\NUnit\DotNet\nunit.framework.dll
+2 -2
View File
@@ -56,7 +56,7 @@ namespace Newtonsoft.Json
} }
/// <summary> /// <summary>
/// Gets or sets how many IndentChars to write for each level in the hierarchy when <paramref name="Formatting"/> is set to <c>Formatting.Indented</c>. /// Gets or sets how many IndentChars to write for each level in the hierarchy when <see cref="Formatting"/> is set to <c>Formatting.Indented</c>.
/// </summary> /// </summary>
public int Indentation public int Indentation
{ {
@@ -86,7 +86,7 @@ namespace Newtonsoft.Json
} }
/// <summary> /// <summary>
/// Gets or sets which character to use for indenting when <paramref name="Formatting"/> is set to <c>Formatting.Indented</c>. /// Gets or sets which character to use for indenting when <see cref="Formatting"/> is set to <c>Formatting.Indented</c>.
/// </summary> /// </summary>
public char IndentChar public char IndentChar
{ {
@@ -80,8 +80,6 @@ namespace Newtonsoft.Json.Linq.ComponentModel
public override object GetValue(object component) public override object GetValue(object component)
{ {
JToken token = CastInstance(component)[Name]; JToken token = CastInstance(component)[Name];
//if (token is JValue)
// return ((JValue) token).Value;
return token; return token;
} }
@@ -1,47 +0,0 @@
#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !PocketPC && !SILVERLIGHT
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace Newtonsoft.Json.Linq.ComponentModel
{
internal class JTypeDescriptionProvider : TypeDescriptionProvider
{
public override ICustomTypeDescriptor GetTypeDescriptor(Type type, object instance)
{
JObject o = instance as JObject;
if (o != null)
return new JTypeDescriptor(o);
return base.GetTypeDescriptor(type, instance);
}
}
}
#endif
@@ -1,209 +0,0 @@
#region License
// Copyright (c) 2007 James Newton-King
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !SILVERLIGHT
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Newtonsoft.Json.Utilities;
namespace Newtonsoft.Json.Linq.ComponentModel
{
/// <summary>
/// Represents a view of a <see cref="JObject"/>.
/// </summary>
public class JTypeDescriptor : ICustomTypeDescriptor
{
private readonly JObject _value;
/// <summary>
/// Initializes a new instance of the <see cref="JTypeDescriptor"/> class.
/// </summary>
/// <param name="value">The value.</param>
public JTypeDescriptor(JObject value)
{
ValidationUtils.ArgumentNotNull(value, "value");
_value = value;
}
/// <summary>
/// Returns the properties for this instance of a component.
/// </summary>
/// <returns>
/// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"/> that represents the properties for this component instance.
/// </returns>
public virtual PropertyDescriptorCollection GetProperties()
{
return GetProperties(null);
}
private static Type GetTokenPropertyType(JToken token)
{
if (token is JValue)
{
JValue v = (JValue) token;
return (v.Value != null) ? v.Value.GetType() : typeof (object);
}
return token.GetType();
}
/// <summary>
/// Returns the properties for this instance of a component using the attribute array as a filter.
/// </summary>
/// <param name="attributes">An array of type <see cref="T:System.Attribute"/> that is used as a filter.</param>
/// <returns>
/// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"/> that represents the filtered properties for this component instance.
/// </returns>
public virtual PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null);
if (_value != null)
{
foreach (KeyValuePair<string, JToken> propertyValue in _value)
{
descriptors.Add(new JPropertyDescriptor(propertyValue.Key, GetTokenPropertyType(propertyValue.Value)));
}
}
return descriptors;
}
/// <summary>
/// Returns a collection of custom attributes for this instance of a component.
/// </summary>
/// <returns>
/// An <see cref="T:System.ComponentModel.AttributeCollection"/> containing the attributes for this object.
/// </returns>
public AttributeCollection GetAttributes()
{
return AttributeCollection.Empty;
}
/// <summary>
/// Returns the class name of this instance of a component.
/// </summary>
/// <returns>
/// The class name of the object, or null if the class does not have a name.
/// </returns>
public string GetClassName()
{
return null;
}
/// <summary>
/// Returns the name of this instance of a component.
/// </summary>
/// <returns>
/// The name of the object, or null if the object does not have a name.
/// </returns>
public string GetComponentName()
{
return null;
}
/// <summary>
/// Returns a type converter for this instance of a component.
/// </summary>
/// <returns>
/// A <see cref="T:System.ComponentModel.TypeConverter"/> that is the converter for this object, or null if there is no <see cref="T:System.ComponentModel.TypeConverter"/> for this object.
/// </returns>
public TypeConverter GetConverter()
{
return new TypeConverter();
}
/// <summary>
/// Returns the default event for this instance of a component.
/// </summary>
/// <returns>
/// An <see cref="T:System.ComponentModel.EventDescriptor"/> that represents the default event for this object, or null if this object does not have events.
/// </returns>
public EventDescriptor GetDefaultEvent()
{
return null;
}
/// <summary>
/// Returns the default property for this instance of a component.
/// </summary>
/// <returns>
/// A <see cref="T:System.ComponentModel.PropertyDescriptor"/> that represents the default property for this object, or null if this object does not have properties.
/// </returns>
public PropertyDescriptor GetDefaultProperty()
{
return null;
}
/// <summary>
/// Returns an editor of the specified type for this instance of a component.
/// </summary>
/// <param name="editorBaseType">A <see cref="T:System.Type"/> that represents the editor for this object.</param>
/// <returns>
/// An <see cref="T:System.Object"/> of the specified type that is the editor for this object, or null if the editor cannot be found.
/// </returns>
public object GetEditor(Type editorBaseType)
{
return null;
}
/// <summary>
/// Returns the events for this instance of a component using the specified attribute array as a filter.
/// </summary>
/// <param name="attributes">An array of type <see cref="T:System.Attribute"/> that is used as a filter.</param>
/// <returns>
/// An <see cref="T:System.ComponentModel.EventDescriptorCollection"/> that represents the filtered events for this component instance.
/// </returns>
public EventDescriptorCollection GetEvents(Attribute[] attributes)
{
return EventDescriptorCollection.Empty;
}
/// <summary>
/// Returns the events for this instance of a component.
/// </summary>
/// <returns>
/// An <see cref="T:System.ComponentModel.EventDescriptorCollection"/> that represents the events for this component instance.
/// </returns>
public EventDescriptorCollection GetEvents()
{
return EventDescriptorCollection.Empty;
}
/// <summary>
/// Returns an object that contains the property described by the specified property descriptor.
/// </summary>
/// <param name="pd">A <see cref="T:System.ComponentModel.PropertyDescriptor"/> that represents the property whose owner is to be found.</param>
/// <returns>
/// An <see cref="T:System.Object"/> that represents the owner of the specified property.
/// </returns>
public object GetPropertyOwner(PropertyDescriptor pd)
{
return null;
}
}
}
#endif
+3 -7
View File
@@ -779,13 +779,9 @@ namespace Newtonsoft.Json.Linq
PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors) PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors)
{ {
JObject o = First as JObject; ICustomTypeDescriptor d = First as ICustomTypeDescriptor;
if (o != null) if (d != null)
{ return d.GetProperties();
// explicitly use constructor because compact framework has no provider
JTypeDescriptor descriptor = new JTypeDescriptor(o);
return descriptor.GetProperties();
}
return null; return null;
} }
+162 -3
View File
@@ -40,10 +40,10 @@ namespace Newtonsoft.Json.Linq
/// <summary> /// <summary>
/// Represents a JSON object. /// Represents a JSON object.
/// </summary> /// </summary>
#if !PocketPC && !SILVERLIGHT
[TypeDescriptionProvider(typeof(JTypeDescriptionProvider))]
#endif
public class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged public class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
#if !PocketPC && !SILVERLIGHT
, ICustomTypeDescriptor
#endif
#if !PocketPC && !SILVERLIGHT && !NET20 #if !PocketPC && !SILVERLIGHT && !NET20
, INotifyPropertyChanging , INotifyPropertyChanging
#endif #endif
@@ -491,5 +491,164 @@ namespace Newtonsoft.Json.Linq
PropertyChanging(this, new PropertyChangingEventArgs(propertyName)); PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
} }
#endif #endif
#if !PocketPC && !SILVERLIGHT
// include custom type descriptor on JObject rather than use a provider because the properties are specific to a type
#region ICustomTypeDescriptor
/// <summary>
/// Returns the properties for this instance of a component.
/// </summary>
/// <returns>
/// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"/> that represents the properties for this component instance.
/// </returns>
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
{
return ((ICustomTypeDescriptor) this).GetProperties(null);
}
private static Type GetTokenPropertyType(JToken token)
{
if (token is JValue)
{
JValue v = (JValue)token;
return (v.Value != null) ? v.Value.GetType() : typeof(object);
}
return token.GetType();
}
/// <summary>
/// Returns the properties for this instance of a component using the attribute array as a filter.
/// </summary>
/// <param name="attributes">An array of type <see cref="T:System.Attribute"/> that is used as a filter.</param>
/// <returns>
/// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"/> that represents the filtered properties for this component instance.
/// </returns>
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
{
PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null);
foreach (KeyValuePair<string, JToken> propertyValue in this)
{
descriptors.Add(new JPropertyDescriptor(propertyValue.Key, GetTokenPropertyType(propertyValue.Value)));
}
return descriptors;
}
/// <summary>
/// Returns a collection of custom attributes for this instance of a component.
/// </summary>
/// <returns>
/// An <see cref="T:System.ComponentModel.AttributeCollection"/> containing the attributes for this object.
/// </returns>
AttributeCollection ICustomTypeDescriptor.GetAttributes()
{
return AttributeCollection.Empty;
}
/// <summary>
/// Returns the class name of this instance of a component.
/// </summary>
/// <returns>
/// The class name of the object, or null if the class does not have a name.
/// </returns>
string ICustomTypeDescriptor.GetClassName()
{
return null;
}
/// <summary>
/// Returns the name of this instance of a component.
/// </summary>
/// <returns>
/// The name of the object, or null if the object does not have a name.
/// </returns>
string ICustomTypeDescriptor.GetComponentName()
{
return null;
}
/// <summary>
/// Returns a type converter for this instance of a component.
/// </summary>
/// <returns>
/// A <see cref="T:System.ComponentModel.TypeConverter"/> that is the converter for this object, or null if there is no <see cref="T:System.ComponentModel.TypeConverter"/> for this object.
/// </returns>
TypeConverter ICustomTypeDescriptor.GetConverter()
{
return new TypeConverter();
}
/// <summary>
/// Returns the default event for this instance of a component.
/// </summary>
/// <returns>
/// An <see cref="T:System.ComponentModel.EventDescriptor"/> that represents the default event for this object, or null if this object does not have events.
/// </returns>
EventDescriptor ICustomTypeDescriptor.GetDefaultEvent()
{
return null;
}
/// <summary>
/// Returns the default property for this instance of a component.
/// </summary>
/// <returns>
/// A <see cref="T:System.ComponentModel.PropertyDescriptor"/> that represents the default property for this object, or null if this object does not have properties.
/// </returns>
PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
{
return null;
}
/// <summary>
/// Returns an editor of the specified type for this instance of a component.
/// </summary>
/// <param name="editorBaseType">A <see cref="T:System.Type"/> that represents the editor for this object.</param>
/// <returns>
/// An <see cref="T:System.Object"/> of the specified type that is the editor for this object, or null if the editor cannot be found.
/// </returns>
object ICustomTypeDescriptor.GetEditor(Type editorBaseType)
{
return null;
}
/// <summary>
/// Returns the events for this instance of a component using the specified attribute array as a filter.
/// </summary>
/// <param name="attributes">An array of type <see cref="T:System.Attribute"/> that is used as a filter.</param>
/// <returns>
/// An <see cref="T:System.ComponentModel.EventDescriptorCollection"/> that represents the filtered events for this component instance.
/// </returns>
EventDescriptorCollection ICustomTypeDescriptor.GetEvents(Attribute[] attributes)
{
return EventDescriptorCollection.Empty;
}
/// <summary>
/// Returns the events for this instance of a component.
/// </summary>
/// <returns>
/// An <see cref="T:System.ComponentModel.EventDescriptorCollection"/> that represents the events for this component instance.
/// </returns>
EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
{
return EventDescriptorCollection.Empty;
}
/// <summary>
/// Returns an object that contains the property described by the specified property descriptor.
/// </summary>
/// <param name="pd">A <see cref="T:System.ComponentModel.PropertyDescriptor"/> that represents the property whose owner is to be found.</param>
/// <returns>
/// An <see cref="T:System.Object"/> that represents the owner of the specified property.
/// </returns>
object ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor pd)
{
return null;
}
#endregion
#endif
} }
} }
@@ -13,8 +13,8 @@ namespace Newtonsoft.Json.Linq
/// <summary> /// <summary>
/// Determines whether the specified objects are equal. /// Determines whether the specified objects are equal.
/// </summary> /// </summary>
/// <param name="x">The first object of type <paramref name="T"/> to compare.</param> /// <param name="x">The first object of type <see cref="JToken"/> to compare.</param>
/// <param name="y">The second object of type <paramref name="T"/> to compare.</param> /// <param name="y">The second object of type <see cref="JToken"/> to compare.</param>
/// <returns> /// <returns>
/// true if the specified objects are equal; otherwise, false. /// true if the specified objects are equal; otherwise, false.
/// </returns> /// </returns>
@@ -1,223 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{256AA604-F61B-4B6D-8D51-C8E6AB11E435}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json</RootNamespace>
<AssemblyName>Newtonsoft.Json.Compact</AssemblyName>
<ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PlatformFamilyName>PocketPC</PlatformFamilyName>
<PlatformID>b2c48bd2-963d-4549-9169-1fa021dce484</PlatformID>
<OSVersion>5.2</OSVersion>
<DeployDirSuffix>Newtonsoft.Json.Compact</DeployDirSuffix>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<NativePlatformName>Windows Mobile 6 Professional SDK</NativePlatformName>
<FormFactorID>
</FormFactorID>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\Compact\</OutputPath>
<DefineConstants>DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<FileAlignment>512</FileAlignment>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\Compact\</OutputPath>
<DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<FileAlignment>512</FileAlignment>
<WarningLevel>4</WarningLevel>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<DocumentationFile>bin\Release\Compact\Newtonsoft.Json.Compact.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Bson\BsonBinaryType.cs" />
<Compile Include="Bson\BsonBinaryWriter.cs" />
<Compile Include="Bson\BsonObjectId.cs" />
<Compile Include="Bson\BsonReader.cs" />
<Compile Include="Bson\BsonToken.cs" />
<Compile Include="Bson\BsonType.cs" />
<Compile Include="Bson\BsonWriter.cs" />
<Compile Include="ConstructorHandling.cs" />
<Compile Include="Converters\BinaryConverter.cs" />
<Compile Include="Converters\BsonObjectIdConverter.cs" />
<Compile Include="Converters\CustomCreationConverter.cs" />
<Compile Include="Converters\DataSetConverter.cs" />
<Compile Include="Converters\DataTableConverter.cs" />
<Compile Include="Converters\DateTimeConverterBase.cs" />
<Compile Include="Converters\EntityKeyMemberConverter.cs" />
<Compile Include="Converters\KeyValuePairConverter.cs" />
<Compile Include="Converters\RegexConverter.cs" />
<Compile Include="Converters\StringEnumConverter.cs" />
<Compile Include="FormatterAssemblyStyle.cs" />
<Compile Include="IJsonLineInfo.cs" />
<Compile Include="JsonArrayAttribute.cs" />
<Compile Include="JsonContainerAttribute.cs" />
<Compile Include="DefaultValueHandling.cs" />
<Compile Include="JsonConverterAttribute.cs" />
<Compile Include="JsonObjectAttribute.cs" />
<Compile Include="JsonSerializerSettings.cs" />
<Compile Include="JsonValidatingReader.cs" />
<Compile Include="Linq\ComponentModel\JPropertyDescriptor.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptionProvider.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptor.cs" />
<Compile Include="Linq\IJEnumerable.cs" />
<Compile Include="Linq\JPath.cs" />
<Compile Include="Linq\JRaw.cs" />
<Compile Include="Linq\JTokenEqualityComparer.cs" />
<Compile Include="Linq\JTokenReader.cs" />
<Compile Include="Linq\JTokenType.cs" />
<Compile Include="Linq\JTokenWriter.cs" />
<Compile Include="MemberSerialization.cs" />
<Compile Include="ObjectCreationHandling.cs" />
<Compile Include="Converters\IsoDateTimeConverter.cs" />
<Compile Include="Converters\JavaScriptDateTimeConverter.cs" />
<Compile Include="Converters\JsonDateTimeSerializationMode.cs" />
<Compile Include="Converters\XmlNodeConverter.cs" />
<Compile Include="JsonTextReader.cs" />
<Compile Include="JsonPropertyAttribute.cs" />
<Compile Include="JsonIgnoreAttribute.cs" />
<Compile Include="JsonTextWriter.cs" />
<Compile Include="JsonWriterException.cs" />
<Compile Include="JsonReaderException.cs" />
<Compile Include="JsonConverter.cs" />
<Compile Include="JsonConverterCollection.cs" />
<Compile Include="JsonReader.cs" />
<Compile Include="JsonConvert.cs" />
<Compile Include="JsonSerializationException.cs" />
<Compile Include="JsonSerializer.cs" />
<Compile Include="Linq\Extensions.cs" />
<Compile Include="Linq\JConstructor.cs" />
<Compile Include="Linq\JContainer.cs" />
<Compile Include="Linq\JEnumerable.cs" />
<Compile Include="Linq\JObject.cs" />
<Compile Include="Linq\JArray.cs" />
<Compile Include="Linq\JToken.cs" />
<Compile Include="Linq\JProperty.cs" />
<Compile Include="Linq\JValue.cs" />
<Compile Include="PreserveReferencesHandling.cs" />
<Compile Include="Required.cs" />
<Compile Include="Schema\Extensions.cs" />
<Compile Include="Schema\JsonSchemaException.cs" />
<Compile Include="Schema\JsonSchemaModel.cs" />
<Compile Include="Schema\JsonSchemaModelBuilder.cs" />
<Compile Include="Schema\JsonSchemaNodeCollection.cs" />
<Compile Include="Schema\JsonSchemaNode.cs" />
<Compile Include="Schema\JsonSchemaWriter.cs" />
<Compile Include="Schema\UndefinedSchemaIdHandling.cs" />
<Compile Include="Schema\ValidationEventArgs.cs" />
<Compile Include="Schema\ValidationEventHandler.cs" />
<Compile Include="SerializationBinder.cs" />
<Compile Include="Serialization\CachedAttributeGetter.cs" />
<Compile Include="Serialization\CamelCasePropertyNamesContractResolver.cs" />
<Compile Include="Serialization\DefaultContractResolver.cs" />
<Compile Include="Serialization\DefaultReferenceResolver.cs" />
<Compile Include="Serialization\DefaultSerializationBinder.cs" />
<Compile Include="Serialization\DynamicValueProvider.cs" />
<Compile Include="Serialization\ErrorContext.cs" />
<Compile Include="Serialization\ErrorEventArgs.cs" />
<Compile Include="Serialization\IContractResolver.cs" />
<Compile Include="Serialization\IReferenceResolver.cs" />
<Compile Include="Serialization\IValueProvider.cs" />
<Compile Include="Serialization\JsonArrayContract.cs" />
<Compile Include="Serialization\JsonContract.cs" />
<Compile Include="Serialization\JsonDictionaryContract.cs" />
<Compile Include="MissingMemberHandling.cs" />
<Compile Include="NullValueHandling.cs" />
<Compile Include="ReferenceLoopHandling.cs" />
<Compile Include="Schema\JsonSchema.cs" />
<Compile Include="Schema\JsonSchemaBuilder.cs" />
<Compile Include="Schema\JsonSchemaConstants.cs" />
<Compile Include="Schema\JsonSchemaGenerator.cs" />
<Compile Include="Schema\JsonSchemaResolver.cs" />
<Compile Include="Schema\JsonSchemaType.cs" />
<Compile Include="Serialization\JsonFormatterConverter.cs" />
<Compile Include="Serialization\JsonISerializableContract.cs" />
<Compile Include="Serialization\JsonLinqContract.cs" />
<Compile Include="Serialization\JsonObjectContract.cs" />
<Compile Include="Serialization\JsonPrimitiveContract.cs" />
<Compile Include="Serialization\JsonProperty.cs" />
<Compile Include="Serialization\JsonPropertyCollection.cs" />
<Compile Include="Serialization\JsonSerializerInternalBase.cs" />
<Compile Include="Serialization\JsonSerializerInternalReader.cs" />
<Compile Include="Serialization\JsonSerializerInternalWriter.cs" />
<Compile Include="Serialization\JsonSerializerProxy.cs" />
<Compile Include="Serialization\JsonStringContract.cs" />
<Compile Include="Serialization\JsonTypeReflector.cs" />
<Compile Include="Serialization\LateBoundMetadataTypeAttribute.cs" />
<Compile Include="Serialization\ObjectConstructor.cs" />
<Compile Include="Serialization\OnErrorAttribute.cs" />
<Compile Include="Serialization\ReflectionValueProvider.cs" />
<Compile Include="StreamingContext.cs" />
<Compile Include="TypeNameHandling.cs" />
<Compile Include="Utilities\Base64Encoder.cs" />
<Compile Include="Utilities\BidirectionalDictionary.cs" />
<Compile Include="Utilities\ConvertUtils.cs" />
<Compile Include="Utilities\CollectionWrapper.cs" />
<Compile Include="Utilities\DateTimeUtils.cs" />
<Compile Include="Utilities\DictionaryWrapper.cs" />
<Compile Include="Utilities\DynamicReflectionDelegateFactory.cs" />
<Compile Include="Utilities\DynamicWrapper.cs" />
<Compile Include="Utilities\EnumUtils.cs" />
<Compile Include="Utilities\EnumValue.cs" />
<Compile Include="Utilities\EnumValues.cs" />
<Compile Include="Utilities\ILGeneratorExtensions.cs" />
<Compile Include="Utilities\JavaScriptUtils.cs" />
<Compile Include="JsonToken.cs" />
<Compile Include="JsonWriter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\CollectionUtils.cs" />
<Compile Include="Utilities\LateBoundReflectionDelegateFactory.cs" />
<Compile Include="Utilities\ListWrapper.cs" />
<Compile Include="Utilities\MathUtils.cs" />
<Compile Include="Utilities\MethodCall.cs" />
<Compile Include="Utilities\MiscellaneousUtils.cs" />
<Compile Include="Utilities\ReflectionDelegateFactory.cs" />
<Compile Include="Utilities\ReflectionUtils.cs" />
<Compile Include="Utilities\StringBuffer.cs" />
<Compile Include="Utilities\StringUtils.cs" />
<Compile Include="Utilities\ThreadSafeStore.cs" />
<Compile Include="Utilities\ValidationUtils.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
<HostingProcess disable="1" />
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
File diff suppressed because one or more lines are too long
@@ -1,4 +1,8 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,7 +14,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Newtonsoft.Json</RootNamespace> <RootNamespace>Newtonsoft.Json</RootNamespace>
<AssemblyName>Newtonsoft.Json.Silverlight</AssemblyName> <AssemblyName>Newtonsoft.Json.Silverlight</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<SilverlightApplication>false</SilverlightApplication> <SilverlightApplication>false</SilverlightApplication>
<ValidateXaml>true</ValidateXaml> <ValidateXaml>true</ValidateXaml>
<ThrowErrorsInValidation>false</ThrowErrorsInValidation> <ThrowErrorsInValidation>false</ThrowErrorsInValidation>
@@ -19,6 +23,25 @@
<OldToolsVersion>3.5</OldToolsVersion> <OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation> <UpgradeBackupLocation>
</UpgradeBackupLocation> </UpgradeBackupLocation>
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<SignManifests>false</SignManifests>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@@ -31,6 +54,8 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>Bin\Debug\Silverlight\Newtonsoft.Json.Silverlight.xml</DocumentationFile> <DocumentationFile>Bin\Debug\Silverlight\Newtonsoft.Json.Silverlight.xml</DocumentationFile>
<CodeAnalysisRuleSet>Newtonsoft.Json.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -42,6 +67,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>Bin\Release\Silverlight\Newtonsoft.Json.Silverlight.xml</DocumentationFile> <DocumentationFile>Bin\Release\Silverlight\Newtonsoft.Json.Silverlight.xml</DocumentationFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
@@ -100,8 +126,6 @@
<Compile Include="JsonWriter.cs" /> <Compile Include="JsonWriter.cs" />
<Compile Include="JsonWriterException.cs" /> <Compile Include="JsonWriterException.cs" />
<Compile Include="Linq\ComponentModel\JPropertyDescriptor.cs" /> <Compile Include="Linq\ComponentModel\JPropertyDescriptor.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptionProvider.cs" />
<Compile Include="Linq\ComponentModel\JTypeDescriptor.cs" />
<Compile Include="Linq\Extensions.cs" /> <Compile Include="Linq\Extensions.cs" />
<Compile Include="Linq\IJEnumerable.cs" /> <Compile Include="Linq\IJEnumerable.cs" />
<Compile Include="Linq\JArray.cs" /> <Compile Include="Linq\JArray.cs" />
@@ -202,7 +226,24 @@
<Compile Include="Schema\JsonSchemaType.cs" /> <Compile Include="Schema\JsonSchemaType.cs" />
<Compile Include="Serialization\JsonTypeReflector.cs" /> <Compile Include="Serialization\JsonTypeReflector.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" Condition="" /> <ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">
File diff suppressed because one or more lines are too long
+234
View File
@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Newtonsoft.Json.ruleset" ToolsVersion="10.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1000" Action="None" />
<Rule Id="CA1001" Action="None" />
<Rule Id="CA1002" Action="None" />
<Rule Id="CA1003" Action="None" />
<Rule Id="CA1004" Action="None" />
<Rule Id="CA1005" Action="None" />
<Rule Id="CA1006" Action="None" />
<Rule Id="CA1007" Action="None" />
<Rule Id="CA1008" Action="None" />
<Rule Id="CA1009" Action="None" />
<Rule Id="CA1010" Action="None" />
<Rule Id="CA1011" Action="None" />
<Rule Id="CA1012" Action="None" />
<Rule Id="CA1013" Action="None" />
<Rule Id="CA1014" Action="None" />
<Rule Id="CA1016" Action="None" />
<Rule Id="CA1017" Action="None" />
<Rule Id="CA1018" Action="None" />
<Rule Id="CA1019" Action="None" />
<Rule Id="CA1020" Action="None" />
<Rule Id="CA1021" Action="None" />
<Rule Id="CA1023" Action="None" />
<Rule Id="CA1024" Action="None" />
<Rule Id="CA1025" Action="None" />
<Rule Id="CA1026" Action="None" />
<Rule Id="CA1027" Action="None" />
<Rule Id="CA1028" Action="None" />
<Rule Id="CA1030" Action="None" />
<Rule Id="CA1031" Action="None" />
<Rule Id="CA1032" Action="None" />
<Rule Id="CA1033" Action="None" />
<Rule Id="CA1034" Action="None" />
<Rule Id="CA1035" Action="None" />
<Rule Id="CA1036" Action="None" />
<Rule Id="CA1038" Action="None" />
<Rule Id="CA1039" Action="None" />
<Rule Id="CA1040" Action="None" />
<Rule Id="CA1041" Action="None" />
<Rule Id="CA1043" Action="None" />
<Rule Id="CA1044" Action="None" />
<Rule Id="CA1045" Action="None" />
<Rule Id="CA1046" Action="None" />
<Rule Id="CA1047" Action="None" />
<Rule Id="CA1048" Action="None" />
<Rule Id="CA1049" Action="None" />
<Rule Id="CA1050" Action="None" />
<Rule Id="CA1051" Action="None" />
<Rule Id="CA1052" Action="None" />
<Rule Id="CA1053" Action="None" />
<Rule Id="CA1054" Action="None" />
<Rule Id="CA1055" Action="None" />
<Rule Id="CA1056" Action="None" />
<Rule Id="CA1057" Action="None" />
<Rule Id="CA1058" Action="None" />
<Rule Id="CA1059" Action="None" />
<Rule Id="CA1060" Action="None" />
<Rule Id="CA1061" Action="None" />
<Rule Id="CA1062" Action="None" />
<Rule Id="CA1063" Action="None" />
<Rule Id="CA1064" Action="None" />
<Rule Id="CA1065" Action="None" />
<Rule Id="CA1300" Action="None" />
<Rule Id="CA1301" Action="None" />
<Rule Id="CA1302" Action="None" />
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1306" Action="None" />
<Rule Id="CA1307" Action="None" />
<Rule Id="CA1308" Action="None" />
<Rule Id="CA1309" Action="None" />
<Rule Id="CA1400" Action="None" />
<Rule Id="CA1401" Action="None" />
<Rule Id="CA1402" Action="None" />
<Rule Id="CA1403" Action="None" />
<Rule Id="CA1404" Action="None" />
<Rule Id="CA1405" Action="None" />
<Rule Id="CA1406" Action="None" />
<Rule Id="CA1407" Action="None" />
<Rule Id="CA1408" Action="None" />
<Rule Id="CA1409" Action="None" />
<Rule Id="CA1410" Action="None" />
<Rule Id="CA1411" Action="None" />
<Rule Id="CA1412" Action="None" />
<Rule Id="CA1413" Action="None" />
<Rule Id="CA1414" Action="None" />
<Rule Id="CA1415" Action="None" />
<Rule Id="CA1500" Action="None" />
<Rule Id="CA1501" Action="None" />
<Rule Id="CA1502" Action="None" />
<Rule Id="CA1504" Action="None" />
<Rule Id="CA1505" Action="None" />
<Rule Id="CA1506" Action="None" />
<Rule Id="CA1600" Action="None" />
<Rule Id="CA1601" Action="None" />
<Rule Id="CA1700" Action="None" />
<Rule Id="CA1701" Action="None" />
<Rule Id="CA1702" Action="None" />
<Rule Id="CA1703" Action="None" />
<Rule Id="CA1704" Action="None" />
<Rule Id="CA1707" Action="None" />
<Rule Id="CA1708" Action="None" />
<Rule Id="CA1709" Action="None" />
<Rule Id="CA1710" Action="None" />
<Rule Id="CA1711" Action="None" />
<Rule Id="CA1712" Action="None" />
<Rule Id="CA1713" Action="None" />
<Rule Id="CA1714" Action="None" />
<Rule Id="CA1715" Action="None" />
<Rule Id="CA1716" Action="None" />
<Rule Id="CA1717" Action="None" />
<Rule Id="CA1719" Action="None" />
<Rule Id="CA1720" Action="None" />
<Rule Id="CA1721" Action="None" />
<Rule Id="CA1722" Action="None" />
<Rule Id="CA1724" Action="None" />
<Rule Id="CA1725" Action="None" />
<Rule Id="CA1726" Action="None" />
<Rule Id="CA1800" Action="None" />
<Rule Id="CA1801" Action="None" />
<Rule Id="CA1802" Action="None" />
<Rule Id="CA1804" Action="None" />
<Rule Id="CA1806" Action="None" />
<Rule Id="CA1809" Action="None" />
<Rule Id="CA1810" Action="None" />
<Rule Id="CA1811" Action="None" />
<Rule Id="CA1812" Action="None" />
<Rule Id="CA1813" Action="None" />
<Rule Id="CA1814" Action="None" />
<Rule Id="CA1815" Action="None" />
<Rule Id="CA1816" Action="None" />
<Rule Id="CA1819" Action="None" />
<Rule Id="CA1820" Action="None" />
<Rule Id="CA1821" Action="None" />
<Rule Id="CA1822" Action="None" />
<Rule Id="CA1823" Action="None" />
<Rule Id="CA1824" Action="None" />
<Rule Id="CA1900" Action="None" />
<Rule Id="CA1901" Action="None" />
<Rule Id="CA1903" Action="Error" />
<Rule Id="CA2000" Action="None" />
<Rule Id="CA2001" Action="None" />
<Rule Id="CA2002" Action="None" />
<Rule Id="CA2003" Action="None" />
<Rule Id="CA2004" Action="None" />
<Rule Id="CA2006" Action="None" />
<Rule Id="CA2100" Action="None" />
<Rule Id="CA2101" Action="None" />
<Rule Id="CA2102" Action="None" />
<Rule Id="CA2103" Action="None" />
<Rule Id="CA2104" Action="None" />
<Rule Id="CA2105" Action="None" />
<Rule Id="CA2106" Action="None" />
<Rule Id="CA2107" Action="None" />
<Rule Id="CA2108" Action="None" />
<Rule Id="CA2109" Action="None" />
<Rule Id="CA2111" Action="None" />
<Rule Id="CA2112" Action="None" />
<Rule Id="CA2114" Action="None" />
<Rule Id="CA2115" Action="None" />
<Rule Id="CA2116" Action="None" />
<Rule Id="CA2117" Action="None" />
<Rule Id="CA2118" Action="None" />
<Rule Id="CA2119" Action="None" />
<Rule Id="CA2120" Action="None" />
<Rule Id="CA2121" Action="None" />
<Rule Id="CA2122" Action="None" />
<Rule Id="CA2123" Action="None" />
<Rule Id="CA2124" Action="None" />
<Rule Id="CA2126" Action="None" />
<Rule Id="CA2130" Action="None" />
<Rule Id="CA2131" Action="None" />
<Rule Id="CA2132" Action="None" />
<Rule Id="CA2133" Action="None" />
<Rule Id="CA2134" Action="None" />
<Rule Id="CA2135" Action="None" />
<Rule Id="CA2136" Action="None" />
<Rule Id="CA2137" Action="None" />
<Rule Id="CA2138" Action="None" />
<Rule Id="CA2139" Action="None" />
<Rule Id="CA2140" Action="None" />
<Rule Id="CA2141" Action="None" />
<Rule Id="CA2142" Action="None" />
<Rule Id="CA2143" Action="None" />
<Rule Id="CA2144" Action="None" />
<Rule Id="CA2145" Action="None" />
<Rule Id="CA2146" Action="None" />
<Rule Id="CA2147" Action="None" />
<Rule Id="CA2149" Action="None" />
<Rule Id="CA2200" Action="None" />
<Rule Id="CA2201" Action="None" />
<Rule Id="CA2202" Action="None" />
<Rule Id="CA2204" Action="None" />
<Rule Id="CA2205" Action="None" />
<Rule Id="CA2207" Action="None" />
<Rule Id="CA2208" Action="None" />
<Rule Id="CA2210" Action="None" />
<Rule Id="CA2211" Action="None" />
<Rule Id="CA2212" Action="None" />
<Rule Id="CA2213" Action="None" />
<Rule Id="CA2214" Action="None" />
<Rule Id="CA2215" Action="None" />
<Rule Id="CA2216" Action="None" />
<Rule Id="CA2217" Action="None" />
<Rule Id="CA2218" Action="None" />
<Rule Id="CA2219" Action="None" />
<Rule Id="CA2220" Action="None" />
<Rule Id="CA2221" Action="None" />
<Rule Id="CA2222" Action="None" />
<Rule Id="CA2223" Action="None" />
<Rule Id="CA2224" Action="None" />
<Rule Id="CA2225" Action="None" />
<Rule Id="CA2226" Action="None" />
<Rule Id="CA2227" Action="None" />
<Rule Id="CA2228" Action="None" />
<Rule Id="CA2229" Action="None" />
<Rule Id="CA2230" Action="None" />
<Rule Id="CA2231" Action="None" />
<Rule Id="CA2232" Action="None" />
<Rule Id="CA2233" Action="None" />
<Rule Id="CA2234" Action="None" />
<Rule Id="CA2235" Action="None" />
<Rule Id="CA2236" Action="None" />
<Rule Id="CA2237" Action="None" />
<Rule Id="CA2238" Action="None" />
<Rule Id="CA2239" Action="None" />
<Rule Id="CA2240" Action="None" />
<Rule Id="CA2241" Action="None" />
<Rule Id="CA2242" Action="None" />
<Rule Id="CA2243" Action="None" />
</Rules>
</RuleSet>
@@ -95,9 +95,9 @@ using System.Security;
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("3.5.0.0")] [assembly: AssemblyVersion("4.0.0.0")]
#if !PocketPC #if !PocketPC
[assembly: AssemblyFileVersion("3.5.0.0")] [assembly: AssemblyFileVersion("4.0.0.0")]
#endif #endif
[assembly: CLSCompliant(true)] [assembly: CLSCompliant(true)]
@@ -25,6 +25,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Reflection; using System.Reflection;
using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Utilities;
using System.Collections; using System.Collections;
@@ -74,15 +75,22 @@ namespace Newtonsoft.Json.Serialization
|| UnderlyingType.IsArray) || UnderlyingType.IsArray)
return new CollectionWrapper<object>((IList)list); return new CollectionWrapper<object>((IList)list);
if (_genericWrapperType == null) if (_genericCollectionDefinitionType != null)
{ {
_genericWrapperType = ReflectionUtils.MakeGenericType(typeof(CollectionWrapper<>), CollectionItemType); if (_genericWrapperType == null)
{
_genericWrapperType = ReflectionUtils.MakeGenericType(typeof (CollectionWrapper<>), CollectionItemType);
ConstructorInfo genericWrapperConstructor = _genericWrapperType.GetConstructor(new[] { _genericCollectionDefinitionType }); ConstructorInfo genericWrapperConstructor = _genericWrapperType.GetConstructor(new[] {_genericCollectionDefinitionType});
_genericWrapperCreator = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall<object>(genericWrapperConstructor); _genericWrapperCreator = JsonTypeReflector.ReflectionDelegateFactory.CreateMethodCall<object>(genericWrapperConstructor);
}
return (IWrappedCollection) _genericWrapperCreator(null, list);
}
else
{
return new CollectionWrapper<object>((IList<object>)((IEnumerable)list).Cast<object>().ToList());
} }
return (IWrappedCollection)_genericWrapperCreator(null, list);
} }
private bool IsTypeGenericCollectionInterface(Type type) private bool IsTypeGenericCollectionInterface(Type type)
@@ -34,6 +34,7 @@ using System.Runtime.Serialization.Formatters;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Utilities;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Security;
namespace Newtonsoft.Json.Serialization namespace Newtonsoft.Json.Serialization
{ {
@@ -118,20 +119,8 @@ namespace Newtonsoft.Json.Serialization
} }
else if (valueContract is JsonArrayContract) else if (valueContract is JsonArrayContract)
{ {
if (value is IList) JsonArrayContract arrayContract = (JsonArrayContract) valueContract;
{ SerializeList(writer, arrayContract.CreateWrapper(value), arrayContract, member, collectionValueContract);
SerializeList(writer, (IList)value, (JsonArrayContract)valueContract, member, collectionValueContract);
}
else if (value is IEnumerable)
{
SerializeList(writer, ((IEnumerable)value).Cast<object>().ToList(), (JsonArrayContract)valueContract, member, collectionValueContract);
}
else
{
throw new Exception(
"Cannot serialize '{0}' into a JSON array. Type does not implement IEnumerable.".FormatWith(
CultureInfo.InvariantCulture, value.GetType()));
}
} }
else if (valueContract is JsonLinqContract) else if (valueContract is JsonLinqContract)
{ {
@@ -371,11 +360,11 @@ namespace Newtonsoft.Json.Serialization
} }
} }
private void SerializeList(JsonWriter writer, IList values, JsonArrayContract contract, JsonProperty member, JsonContract collectionValueContract) private void SerializeList(JsonWriter writer, IWrappedCollection values, JsonArrayContract contract, JsonProperty member, JsonContract collectionValueContract)
{ {
contract.InvokeOnSerializing(values, Serializer.Context); contract.InvokeOnSerializing(values.UnderlyingCollection, Serializer.Context);
SerializeStack.Add(values); SerializeStack.Add(values.UnderlyingCollection);
bool isReference = contract.IsReference ?? HasFlag(Serializer.PreserveReferencesHandling, PreserveReferencesHandling.Arrays); bool isReference = contract.IsReference ?? HasFlag(Serializer.PreserveReferencesHandling, PreserveReferencesHandling.Arrays);
bool includeTypeDetails = ShouldWriteType(TypeNameHandling.Arrays, contract, member, collectionValueContract); bool includeTypeDetails = ShouldWriteType(TypeNameHandling.Arrays, contract, member, collectionValueContract);
@@ -387,11 +376,11 @@ namespace Newtonsoft.Json.Serialization
if (isReference) if (isReference)
{ {
writer.WritePropertyName(JsonTypeReflector.IdPropertyName); writer.WritePropertyName(JsonTypeReflector.IdPropertyName);
writer.WriteValue(Serializer.ReferenceResolver.GetReference(values)); writer.WriteValue(Serializer.ReferenceResolver.GetReference(values.UnderlyingCollection));
} }
if (includeTypeDetails) if (includeTypeDetails)
{ {
WriteTypeProperty(writer, values.GetType()); WriteTypeProperty(writer, values.UnderlyingCollection.GetType());
} }
writer.WritePropertyName(JsonTypeReflector.ArrayValuesPropertyName); writer.WritePropertyName(JsonTypeReflector.ArrayValuesPropertyName);
} }
@@ -402,11 +391,12 @@ namespace Newtonsoft.Json.Serialization
int initialDepth = writer.Top; int initialDepth = writer.Top;
for (int i = 0; i < values.Count; i++) int index = 0;
// note that an error in the IEnumerable won't be caught
foreach (object value in values)
{ {
try try
{ {
object value = values[i];
JsonContract valueContract = GetContractSafe(value); JsonContract valueContract = GetContractSafe(value);
if (ShouldWriteReference(value, null, valueContract)) if (ShouldWriteReference(value, null, valueContract))
@@ -415,19 +405,23 @@ namespace Newtonsoft.Json.Serialization
} }
else else
{ {
if (!CheckForCircularReference(value, null, contract)) if (CheckForCircularReference(value, null, contract))
continue; {
SerializeValue(writer, value, valueContract, null, childValuesContract);
SerializeValue(writer, value, valueContract, null, childValuesContract); }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
if (IsErrorHandled(values, contract, i, ex)) if (IsErrorHandled(values.UnderlyingCollection, contract, index, ex))
HandleError(writer, initialDepth); HandleError(writer, initialDepth);
else else
throw; throw;
} }
finally
{
index++;
}
} }
writer.WriteEndArray(); writer.WriteEndArray();
@@ -439,10 +433,13 @@ namespace Newtonsoft.Json.Serialization
SerializeStack.RemoveAt(SerializeStack.Count - 1); SerializeStack.RemoveAt(SerializeStack.Count - 1);
contract.InvokeOnSerialized(values, Serializer.Context); contract.InvokeOnSerialized(values.UnderlyingCollection, Serializer.Context);
} }
#if !SILVERLIGHT && !PocketPC #if !SILVERLIGHT && !PocketPC
#if !NET20
[SecuritySafeCritical]
#endif
private void SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract) private void SerializeISerializable(JsonWriter writer, ISerializable value, JsonISerializableContract contract)
{ {
contract.InvokeOnSerializing(value, Serializer.Context); contract.InvokeOnSerializing(value, Serializer.Context);
@@ -61,7 +61,7 @@ namespace Newtonsoft.Json.Utilities
_genericCollection = list; _genericCollection = list;
} }
public void Add(T item) public virtual void Add(T item)
{ {
if (_genericCollection != null) if (_genericCollection != null)
_genericCollection.Add(item); _genericCollection.Add(item);
@@ -69,7 +69,7 @@ namespace Newtonsoft.Json.Utilities
_list.Add(item); _list.Add(item);
} }
public void Clear() public virtual void Clear()
{ {
if (_genericCollection != null) if (_genericCollection != null)
_genericCollection.Clear(); _genericCollection.Clear();
@@ -77,7 +77,7 @@ namespace Newtonsoft.Json.Utilities
_list.Clear(); _list.Clear();
} }
public bool Contains(T item) public virtual bool Contains(T item)
{ {
if (_genericCollection != null) if (_genericCollection != null)
return _genericCollection.Contains(item); return _genericCollection.Contains(item);
@@ -85,7 +85,7 @@ namespace Newtonsoft.Json.Utilities
return _list.Contains(item); return _list.Contains(item);
} }
public void CopyTo(T[] array, int arrayIndex) public virtual void CopyTo(T[] array, int arrayIndex)
{ {
if (_genericCollection != null) if (_genericCollection != null)
_genericCollection.CopyTo(array, arrayIndex); _genericCollection.CopyTo(array, arrayIndex);
@@ -93,7 +93,7 @@ namespace Newtonsoft.Json.Utilities
_list.CopyTo(array, arrayIndex); _list.CopyTo(array, arrayIndex);
} }
public int Count public virtual int Count
{ {
get get
{ {
@@ -104,7 +104,7 @@ namespace Newtonsoft.Json.Utilities
} }
} }
public bool IsReadOnly public virtual bool IsReadOnly
{ {
get get
{ {
@@ -115,7 +115,7 @@ namespace Newtonsoft.Json.Utilities
} }
} }
public bool Remove(T item) public virtual bool Remove(T item)
{ {
if (_genericCollection != null) if (_genericCollection != null)
{ {
@@ -132,7 +132,7 @@ namespace Newtonsoft.Json.Utilities
} }
} }
public IEnumerator<T> GetEnumerator() public virtual IEnumerator<T> GetEnumerator()
{ {
if (_genericCollection != null) if (_genericCollection != null)
return _genericCollection.GetEnumerator(); return _genericCollection.GetEnumerator();
@@ -235,7 +235,11 @@ namespace Newtonsoft.Json.Utilities
if (targetType == typeof (Uri)) if (targetType == typeof (Uri))
return new Uri((string) initialValue); return new Uri((string) initialValue);
if (targetType == typeof (TimeSpan)) if (targetType == typeof (TimeSpan))
return TimeSpan.Parse((string) initialValue); #if !NET20 && !SILVERLIGHT
return TimeSpan.Parse((string) initialValue, CultureInfo.InvariantCulture);
#else
return TimeSpan.Parse((string)initialValue);
#endif
} }
#if !PocketPC #if !PocketPC
+26 -122
View File
@@ -38,23 +38,21 @@ namespace Newtonsoft.Json.Utilities
object UnderlyingList { get; } object UnderlyingList { get; }
} }
internal class ListWrapper<T> : IList<T>, IWrappedList internal class ListWrapper<T> : CollectionWrapper<T>, IList<T>, IWrappedList
{ {
private readonly IList _list;
private readonly IList<T> _genericList; private readonly IList<T> _genericList;
private object _syncRoot;
public ListWrapper(IList list) public ListWrapper(IList list)
: base(list)
{ {
ValidationUtils.ArgumentNotNull(list, "list"); ValidationUtils.ArgumentNotNull(list, "list");
if (list is IList<T>) if (list is IList<T>)
_genericList = (IList<T>) list; _genericList = (IList<T>) list;
else
_list = list;
} }
public ListWrapper(IList<T> list) public ListWrapper(IList<T> list)
: base(list)
{ {
ValidationUtils.ArgumentNotNull(list, "list"); ValidationUtils.ArgumentNotNull(list, "list");
@@ -66,7 +64,7 @@ namespace Newtonsoft.Json.Utilities
if (_genericList != null) if (_genericList != null)
return _genericList.IndexOf(item); return _genericList.IndexOf(item);
else else
return _list.IndexOf(item); return ((IList)this).IndexOf(item);
} }
public void Insert(int index, T item) public void Insert(int index, T item)
@@ -74,7 +72,7 @@ namespace Newtonsoft.Json.Utilities
if (_genericList != null) if (_genericList != null)
_genericList.Insert(index, item); _genericList.Insert(index, item);
else else
_list.Insert(index, item); ((IList)this).Insert(index, item);
} }
public void RemoveAt(int index) public void RemoveAt(int index)
@@ -82,7 +80,7 @@ namespace Newtonsoft.Json.Utilities
if (_genericList != null) if (_genericList != null)
_genericList.RemoveAt(index); _genericList.RemoveAt(index);
else else
_list.RemoveAt(index); ((IList)this).RemoveAt(index);
} }
public T this[int index] public T this[int index]
@@ -92,72 +90,72 @@ namespace Newtonsoft.Json.Utilities
if (_genericList != null) if (_genericList != null)
return _genericList[index]; return _genericList[index];
else else
return (T)_list[index]; return (T)((IList)this)[index];
} }
set set
{ {
if (_genericList != null) if (_genericList != null)
_genericList[index] = value; _genericList[index] = value;
else else
_list[index] = value; ((IList)this)[index] = value;
} }
} }
public void Add(T item) public override void Add(T item)
{ {
if (_genericList != null) if (_genericList != null)
_genericList.Add(item); _genericList.Add(item);
else else
_list.Add(item); base.Add(item);
} }
public void Clear() public override void Clear()
{ {
if (_genericList != null) if (_genericList != null)
_genericList.Clear(); _genericList.Clear();
else else
_list.Clear(); base.Clear();
} }
public bool Contains(T item) public override bool Contains(T item)
{ {
if (_genericList != null) if (_genericList != null)
return _genericList.Contains(item); return _genericList.Contains(item);
else else
return _list.Contains(item); return base.Contains(item);
} }
public void CopyTo(T[] array, int arrayIndex) public override void CopyTo(T[] array, int arrayIndex)
{ {
if (_genericList != null) if (_genericList != null)
_genericList.CopyTo(array, arrayIndex); _genericList.CopyTo(array, arrayIndex);
else else
_list.CopyTo(array, arrayIndex); base.CopyTo(array, arrayIndex);
} }
public int Count public override int Count
{ {
get get
{ {
if (_genericList != null) if (_genericList != null)
return _genericList.Count; return _genericList.Count;
else else
return _list.Count; return base.Count;
} }
} }
public bool IsReadOnly public override bool IsReadOnly
{ {
get get
{ {
if (_genericList != null) if (_genericList != null)
return _genericList.IsReadOnly; return _genericList.IsReadOnly;
else else
return _list.IsReadOnly; return base.IsReadOnly;
} }
} }
public bool Remove(T item) public override bool Remove(T item)
{ {
if (_genericList != null) if (_genericList != null)
{ {
@@ -165,115 +163,21 @@ namespace Newtonsoft.Json.Utilities
} }
else else
{ {
bool contains = _list.Contains(item); bool contains = base.Contains(item);
if (contains) if (contains)
_list.Remove(item); base.Remove(item);
return contains; return contains;
} }
} }
public IEnumerator<T> GetEnumerator() public override IEnumerator<T> GetEnumerator()
{ {
if (_genericList != null) if (_genericList != null)
return _genericList.GetEnumerator(); return _genericList.GetEnumerator();
return _list.Cast<T>().GetEnumerator(); return base.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
if (_genericList != null)
return _genericList.GetEnumerator();
else
return _list.GetEnumerator();
}
int IList.Add(object value)
{
VerifyValueType(value);
Add((T)value);
return (Count - 1);
}
bool IList.Contains(object value)
{
if (IsCompatibleObject(value))
return Contains((T)value);
return false;
}
int IList.IndexOf(object value)
{
if (IsCompatibleObject(value))
return IndexOf((T)value);
return -1;
}
void IList.Insert(int index, object value)
{
VerifyValueType(value);
Insert(index, (T)value);
}
bool IList.IsFixedSize
{
get { return false; }
}
void IList.Remove(object value)
{
if (IsCompatibleObject(value))
Remove((T)value);
}
object IList.this[int index]
{
get { return this[index]; }
set
{
VerifyValueType(value);
this[index] = (T)value;
}
}
void ICollection.CopyTo(Array array, int arrayIndex)
{
CopyTo((T[])array, arrayIndex);
}
bool ICollection.IsSynchronized
{
get { return false; }
}
object ICollection.SyncRoot
{
get
{
if (_syncRoot == null)
Interlocked.CompareExchange(ref _syncRoot, new object(), null);
return _syncRoot;
}
}
private static void VerifyValueType(object value)
{
if (!IsCompatibleObject(value))
throw new ArgumentException("The value '{0}' is not of type '{1}' and cannot be used in this generic collection.".FormatWith(CultureInfo.InvariantCulture, value, typeof(T)), "value");
}
private static bool IsCompatibleObject(object value)
{
if (!(value is T) && (value != null || (typeof(T).IsValueType && !ReflectionUtils.IsNullableType(typeof(T)))))
return false;
return true;
} }
public object UnderlyingList public object UnderlyingList
@@ -283,7 +187,7 @@ namespace Newtonsoft.Json.Utilities
if (_genericList != null) if (_genericList != null)
return _genericList; return _genericList;
else else
return _list; return UnderlyingCollection;
} }
} }
} }
+457 -382
View File
File diff suppressed because it is too large Load Diff