-Added ReflectionDelegateFactory, DynamicReflectionDelegateFactory and LateBoundDelegateFactory to support switching between dynamic and late bound reflection for medium trust environments
-Added WriteObjectId to BsonWriter -Added BsonObjectId and BsonObjectIdConverter classes -Added KeyValuePairConverter -Added DynamicCodeGeneration flag to DefaultContractResolver -Changed JsonConverter.ReadJson to add an extra parameter: currentValue
This commit is contained in:
+5
-5
@@ -34,7 +34,7 @@ using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Utilities
|
||||
{
|
||||
public class LateBoundDelegateFactoryTests : TestFixtureBase
|
||||
public class DynamicReflectionDelegateFactoryTests : TestFixtureBase
|
||||
{
|
||||
[Test]
|
||||
[ExpectedException(typeof(InvalidCastException), ExpectedMessage = "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.")]
|
||||
@@ -43,7 +43,7 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
Person p = new Person();
|
||||
p.Name = "Hi";
|
||||
|
||||
Func<object, object> setter = LateBoundDelegateFactory.CreateGet<object>(typeof(Movie).GetProperty("Name"));
|
||||
Func<object, object> setter = DynamicReflectionDelegateFactory.Instance.CreateGet<object>(typeof(Movie).GetProperty("Name"));
|
||||
|
||||
setter(p);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
Person p = new Person();
|
||||
Movie m = new Movie();
|
||||
|
||||
Action<object, object> setter = LateBoundDelegateFactory.CreateSet<object>(typeof(Movie).GetProperty("Name"));
|
||||
Action<object, object> setter = DynamicReflectionDelegateFactory.Instance.CreateSet<object>(typeof(Movie).GetProperty("Name"));
|
||||
|
||||
setter(m, "Hi");
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
{
|
||||
object structTest = new StructTest();
|
||||
|
||||
Action<object, object> setter = LateBoundDelegateFactory.CreateSet<object>(typeof(StructTest).GetProperty("StringProperty"));
|
||||
Action<object, object> setter = DynamicReflectionDelegateFactory.Instance.CreateSet<object>(typeof(StructTest).GetProperty("StringProperty"));
|
||||
|
||||
setter(structTest, "Hi");
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
{
|
||||
Movie m = new Movie();
|
||||
|
||||
Action<object, object> setter = LateBoundDelegateFactory.CreateSet<object>(typeof(Movie).GetProperty("Name"));
|
||||
Action<object, object> setter = DynamicReflectionDelegateFactory.Instance.CreateSet<object>(typeof(Movie).GetProperty("Name"));
|
||||
|
||||
setter(m, new Version());
|
||||
}
|
||||
Reference in New Issue
Block a user