Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added dictionary extension in addition to anonymous type

  • Loading branch information...
commit 1d68fdc45818718a6626a49ad40c15d0b49ea141 1 parent 90c9070
@phatboyg authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/Magnum/Reflection/InterfaceImplementationExtensions.cs
View
16 src/Magnum/Reflection/InterfaceImplementationExtensions.cs
@@ -23,18 +23,30 @@ public static class InterfaceImplementationExtensions
public static object InitializeProxy(this Type interfaceType, object initializer)
{
+ IDictionary<string, object> values = _converter.Convert(initializer);
+
+ return InitializeProxy(interfaceType, values);
+ }
+
+ public static object InitializeProxy(this Type interfaceType, IDictionary<string, object> values)
+ {
Type proxyType = InterfaceImplementationBuilder.GetProxyFor(interfaceType);
object proxy = FastActivator.Create(proxyType);
- IDictionary<string, object> values = _converter.Convert(initializer);
-
return _initializer.InitializeFromDictionary(proxy, values);
}
public static T InitializeProxy<T>(object initializer)
+ where T : class
{
return (T)InitializeProxy(typeof(T), initializer);
}
+
+ public static T InitializeProxy<T>(IDictionary<string, object> values)
+ where T : class
+ {
+ return (T)InitializeProxy(typeof(T), values);
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.