-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set AutoQueryable targer netstandard 1.3 & net451
Add FilterAttributes for aspnet & aspnet core Separate filter attributes in different nuget packages
- Loading branch information
1 parent
2226226
commit c224e13
Showing
10 changed files
with
59 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
src/AutoQueryable.AspNetCore.Filter/Attributes/AutoQueryableAttribute.cs
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
src/AutoQueryable.AspNetCore.Filter/FilterAttributes/AutoQueryableAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using AutoQueryable.Helpers; | ||
using AutoQueryable.Models; | ||
|
||
namespace AutoQueryable.AspNetCore.Filter.FilterAttributes | ||
{ | ||
public class AutoQueryableAttribute : ActionFilterAttribute | ||
{ | ||
public string[] UnselectableProperties { get; set; } | ||
|
||
public override void OnActionExecuted(ActionExecutedContext context) | ||
{ | ||
dynamic query = ((ObjectResult)context.Result).Value; | ||
if (query == null) throw new Exception("Unable to retreive value of IQueryable from context result."); | ||
Type entityType = query.GetType().GenericTypeArguments[0]; | ||
|
||
string queryString = context.HttpContext.Request.QueryString.HasValue ? context.HttpContext.Request.QueryString.Value : null; | ||
context.Result = new OkObjectResult(QueryableHelper.GetAutoQuery(queryString, entityType, query, new AutoQueryableProfile { UnselectableProperties = UnselectableProperties })); | ||
} | ||
} | ||
} |
32 changes: 0 additions & 32 deletions
32
src/AutoQueryable.AspNetCore.Filter/Filters/AutoQueryableFilter.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters