Skip to content

Commit e400600

Browse files
committed
webapi2 action filter attribute modified for inversion of controls
1 parent 3bba647 commit e400600

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/JQDT.MVC/JQDataTableAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public JQDataTableAttribute()
2727

2828
/// <summary>
2929
/// Initializes a new instance of the <see cref="JQDataTableAttribute"/> class.
30-
/// This constructor is used for testing purposes.
30+
/// This constructor is provided for testing purposes.
3131
/// </summary>
3232
/// <param name="serviceLocator">The service locator.</param>
3333
internal JQDataTableAttribute(IServiceLocator serviceLocator)

src/JQDT.WebAPI/JQDataTableAttribute.cs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Web.Http.Filters;
77
using JQDT.ActionFilters;
88
using JQDT.Application;
9+
using JQDT.DI;
910
using JQDT.Exceptions;
1011
using JQDT.Models;
1112

@@ -16,6 +17,26 @@
1617
/// <seealso cref="System.Web.Http.Filters.ActionFilterAttribute" />
1718
public class JQDataTableAttribute : ActionFilterAttribute, IJQDTActionFilter
1819
{
20+
private readonly IServiceLocator serviceLocator;
21+
22+
/// <summary>
23+
/// Initializes a new instance of the <see cref="JQDataTableAttribute"/> class.
24+
/// </summary>
25+
public JQDataTableAttribute()
26+
: this(new ServiceLocator())
27+
{
28+
}
29+
30+
/// <summary>
31+
/// Initializes a new instance of the <see cref="JQDataTableAttribute"/> class.
32+
/// This constructor is provided for testing purposes.
33+
/// </summary>
34+
/// <param name="serviceLocator">The service locator.</param>
35+
internal JQDataTableAttribute(IServiceLocator serviceLocator)
36+
{
37+
this.serviceLocator = serviceLocator;
38+
}
39+
1940
/// <summary>
2041
/// Occurs after the action method is invoked.
2142
/// </summary>
@@ -42,7 +63,6 @@ public override void OnActionExecuted(HttpActionExecutedContext actionExecutedCo
4263
/// <param name="requestInfoModel">The request information model.</param>
4364
public virtual void OnDataProcessed(ref object data, RequestInfoModel requestInfoModel)
4465
{
45-
// No data processing logic by default;
4666
}
4767

4868
/// <summary>

0 commit comments

Comments
 (0)