File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 33 using System ;
44 using System . Web . Mvc ;
55 using JQDT . Application ;
6+ using JQDT . DI ;
67 using JQDT . Exceptions ;
78 using JQDT . Models ;
89
1314 [ AttributeUsage ( validOn : AttributeTargets . Method , AllowMultiple = false ) ]
1415 public class JQDataTableAttribute : ActionFilterAttribute
1516 {
17+ private readonly IServiceLocator serviceLocator ;
18+
19+ /// <summary>
20+ /// Initializes a new instance of the <see cref="JQDataTableAttribute"/> class.
21+ /// </summary>
22+ public JQDataTableAttribute ( )
23+ : this ( new ServiceLocator ( ) )
24+ {
25+ }
26+
27+ /// <summary>
28+ /// Initializes a new instance of the <see cref="JQDataTableAttribute"/> class.
29+ /// This constructor is used for testing purposes.
30+ /// </summary>
31+ /// <param name="serviceLocator">The service locator.</param>
32+ internal JQDataTableAttribute ( IServiceLocator serviceLocator )
33+ {
34+ this . serviceLocator = serviceLocator ;
35+ }
36+
1637 /// <summary>
1738 /// Called by the ASP.NET MVC framework after the action method executes.
1839 /// </summary>
@@ -159,7 +180,6 @@ private void PerformOnActionExecuted(ActionExecutedContext filterContext)
159180 {
160181 var dataCollectionType = filterContext . Controller . ViewData . Model . GetType ( ) ;
161182 var applicationInitizlizationFunction = ExecuteFunctionProvider < ActionExecutedContext > . GetAppInicializationFunc ( dataCollectionType , typeof ( ApplicationMvc < > ) ) ;
162- var serviceLocator = new DI . ServiceLocator ( ) ;
163183 var formModelBinder = serviceLocator . GetFormModelBinder ( ) ;
164184 var mvcApplication = applicationInitizlizationFunction ( filterContext , serviceLocator , formModelBinder ) ;
165185 this . SubscribeToEvents ( mvcApplication ) ;
You can’t perform that action at this time.
0 commit comments