Improve MVC 3, 4 application View DI performance

Ignore MVC view service injection check to improve MVC 3, 4 view object
creation  performance.
This commit is contained in:
kamiff
2015-01-27 11:46:04 +08:00
parent a32fee13be
commit 8e90024231
2 changed files with 10 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ namespace Spring.Web.Mvc
/// </summary>
public class SpringMvcDependencyResolver : IDependencyResolver
{
private static readonly string IgnoreViewNamespace = "ASP.";
private IApplicationContext _context;
@@ -66,6 +67,10 @@ namespace Spring.Web.Mvc
/// <returns>The requested service or object.</returns>
public object GetService(Type serviceType)
{
if (serviceType.FullName.StartsWith(IgnoreViewNamespace))
{
return null;
}
object service = null;
if (serviceType != null)

View File

@@ -12,7 +12,7 @@ namespace Spring.Web.Mvc
/// </summary>
public class SpringMvcDependencyResolver : IDependencyResolver
{
private static readonly string IgnoreViewNamespace = "ASP.";
/// <summary>
/// The <see cref="IApplicationContext"/> to be used by the resolver
/// </summary>
@@ -70,6 +70,10 @@ namespace Spring.Web.Mvc
/// <returns>The requested service or object.</returns>
public object GetService(Type serviceType)
{
if (serviceType.FullName.StartsWith(IgnoreViewNamespace))
{
return null;
}
object service = null;
if (serviceType != null)