Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Commented Issue: Url.Action overloads (and similar) ignore inherited properties [1658]

$
0
0
In MVC4, Url.Action (and similar functions) that take an 'object' of route values would construct a route value dictionary directly and rely on the logic inside the RouteValueDictionary class to construct the set of properties and values.

In MVC5 we attempted to optimize this code path by using a cached reflection system - this has the side-effect of ignoring inherited properties and ignoring the TypeDescriptor - which is used by RouteValueDictionary


Expected:
~/?Bar=cool&Foo=Uncool

Actual:
~/?Bar=cool

'''
public class HomeController : Controller
{
//
// GET: /Home/
[Route("")]
public string Index()
{
return Url.Action("Index", "Home", new D() { Bar = "cool", Foo = "Uncool" });
}

private class D : B
{
public string Bar { get; set; }
}

private class B
{
public string Foo { get; set; }
}
}
}
'''
Comments: Fixed with 54866f0d3262d0fccfc2cb463f003459fcabd6c8 in dev3-1-1 branch and 1e6b50cbe29c51ebdfc2a93e8369b93068c11197 in master

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>