Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to standard 2.1 and Fix Guid Searchable #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AspNetCoreWeb/AspNetCoreWeb.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>netstandard2.1</TargetFramework>
<Authors>Abdul Rahman (@fingers10)</Authors>
<Company>Abdul Rahman (@fingers10)</Company>
<Product>Fingers10.JqueryDataTablesServerSide.AspNetCore</Product>
Expand Down Expand Up @@ -35,7 +35,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Localization" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Text.Json" Version="4.7.1" />
<PackageReference Include="System.Text.Json" Version="4.7.2" />
<None Include="Images\icon.png" Pack="true" PackagePath="" />
<None Include="..\LICENSE.md" Pack="true" PackagePath="" />
</ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions AspNetCoreWeb/Attributes/SearchableDoubleAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,14 @@ public SearchableDoubleAttribute()
ExpressionProvider = new DoubleSearchExpressionProvider();
}
}


[AttributeUsage(AttributeTargets.Property)]
public class SearchableGuidAttribute : SearchableAttribute
{
public SearchableGuidAttribute()
{
ExpressionProvider = new GuidSearchExpressionProvider();
}
}
}
18 changes: 18 additions & 0 deletions AspNetCoreWeb/Providers/GuidSearchExpressionProvider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System;
using System.Linq.Expressions;

namespace JqueryDataTables.ServerSide.AspNetCoreWeb.Providers
{
public class GuidSearchExpressionProvider : ComparableSearchExpressionProvider
{
public override ConstantExpression GetValue(string input)
{
if (!Guid.TryParse(input, out var value))
{
throw new ArgumentException("Invalid search value.");
}

return Expression.Constant(value);
}
}
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ If you liked `JqueryDataTablesServerSide` project or if it helped you, please gi
* `[SearchableLong]`
* `[SearchableDecimal]`
* `[SearchableDouble]`
* `[SearchableGuid]`
* `[SearchableEnum(typeof(TEnum))]`
* `[NestedSearchable]`

Expand Down Expand Up @@ -82,21 +83,20 @@ And here are the options,
# Compatibility Chart
>The following chart describes the operator compatibility with data types with green as compatible and red as not compatible.

|Operator|Description|`string`|`DateTime`|`short`|`int`|`long`|`decimal`|`double`|`enum`|
|Operator|Description|`string`|`DateTime`|`short`|`int`|`long`|`decimal`|`double`|`enum`|`guid`|
|--------|-----------|--------|----------|-------|-----|------|---------|--------|------|
|`co` |Contains |:heavy_check_mark:|:x:|:x:|:x:|:x:|:x:|:x:|:heavy_check_mark:|
|`co` |Contains |:heavy_check_mark:|:x:|:x:|:x:|:x:|:x:|:x:|:heavy_check_mark:|:heavy_check_mark:
|`eq` |Equals | :heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
|`gt` |GreaterThan| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|
|`gte` |GreaterThanEqual| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|
|`lt` |LesserThan| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|
|`lte` |LesserThanEqual| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|
|`gt` |GreaterThan| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|:x:
|`gte` |GreaterThanEqual| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|:x:
|`lt` |LesserThan| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|:x:
|`lte` |LesserThanEqual| :x:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:x:|:x:

# NuGet:
* [JqueryDataTables.ServerSide.AspNetCoreWeb](https://www.nuget.org/packages/JqueryDataTables.ServerSide.AspNetCoreWeb/) **v4.0.0**
* [JqueryDataTables.ServerSide.AspNetCoreWeb](https://www.nuget.org/packages/JqueryDataTables.ServerSide.AspNetCoreWeb/) **v4.0.1**

# Usage:
To activate and make Jquery DataTable communicate with asp.net core backend,

To activate and make Jquery DataTable communicate with asp.net core backend,1
## Package Manager:
```c#
PM> Install-Package JqueryDataTables.ServerSide.AspNetCoreWeb
Expand Down