Fix build issues with Injector

This was causing intellisense failures in VS. It looks like the
commandline is able to accidentally pick up the compatability extensions
from the model binding assembly, but this is not the case in VS.

Changed this code not to rely on compatability extensions.
This commit is contained in:
Ryan Nowak 2014-03-27 15:07:28 -07:00
parent 44af396da9
commit ffb73a1ed8
1 changed files with 12 additions and 2 deletions

View File

@ -32,7 +32,12 @@ namespace Microsoft.AspNet.Mvc
{
var type = obj.GetType();
var property = type.GetProperty(propertyName);
var property = type.GetRuntimeProperty(propertyName);
if (property == null)
{
return;
}
if (property.PropertyType.IsAssignableFrom(typeof(TProperty)))
{
property.SetValue(obj, value);
@ -43,7 +48,12 @@ namespace Microsoft.AspNet.Mvc
{
var type = obj.GetType();
var property = type.GetProperty(propertyName);
var property = type.GetRuntimeProperty(propertyName);
if (property == null)
{
return;
}
if (property.PropertyType.IsAssignableFrom(typeof(TProperty)))
{
property.SetValue(obj, services.GetService<TProperty>());