File tree Expand file tree Collapse file tree 5 files changed +35
-18
lines changed
Mvc.JQuery.DataTables.AspNetCore.Example/Controllers
Mvc.JQuery.DataTables.AspNetCore
Mvc.JQuery.DataTables.Common Expand file tree Collapse file tree 5 files changed +35
-18
lines changed Original file line number Diff line number Diff line change 44using Mvc . JQuery . DataTables . Models ;
55using Mvc . JQuery . DataTables . Serialization ;
66using System . Linq ;
7+ using System . Reflection ;
78
89namespace Mvc . JQuery . DataTables . Example . Controllers
910{
@@ -109,5 +110,10 @@ public DataTablesResult<UserTableRowViewModel> GetUsers([FromForm] DataTablesPar
109110 } ) ;
110111 }
111112
113+ public ContentResult EmbeddedResource ( )
114+ {
115+ var assembly = typeof ( DataTableConfigVm ) . GetTypeInfo ( ) . Assembly ;
116+ return Content ( string . Join ( "|" , assembly . GetManifestResourceNames ( ) . Select ( r => r ) ) ) ;
117+ }
112118 }
113119}
Original file line number Diff line number Diff line change @@ -16,11 +16,15 @@ public Task BindModelAsync(ModelBindingContext bindingContext)
1616 //TODO: Consider whether this should be pushed to a worker thread...
1717 if ( columns == 0 )
1818 {
19- return Task . FromResult ( BindV10Model ( valueProvider ) ) ;
19+ var bindV10Model = BindV10Model ( valueProvider ) ;
20+ bindingContext . Result = ModelBindingResult . Success ( bindV10Model ) ;
21+ return Task . FromResult ( bindV10Model ) ;
2022 }
2123 else
2224 {
23- return Task . FromResult ( BindLegacyModel ( valueProvider , columns ) ) ;
25+ var bindLegacyModel = BindLegacyModel ( valueProvider , columns ) ;
26+ bindingContext . Result = ModelBindingResult . Success ( bindLegacyModel ) ;
27+ return Task . FromResult ( bindLegacyModel ) ;
2428 }
2529 }
2630
@@ -110,7 +114,7 @@ public IModelBinder GetBinder(ModelBinderProviderContext context)
110114 throw new ArgumentNullException ( nameof ( context ) ) ;
111115 }
112116
113- if ( ! context . Metadata . IsComplexType && context . Metadata . ModelType == typeof ( string ) ) // only encode string types
117+ if ( context . Metadata . ModelType == typeof ( DataTablesParam ) ) // only encode string types
114118 {
115119 return new DataTablesModelBinder ( ) ;
116120 }
Original file line number Diff line number Diff line change @@ -49,12 +49,18 @@ public static IApplicationBuilder UseMvcJQueryDataTables(this IApplicationBuilde
4949 if ( settings == null )
5050 {
5151 throw new InvalidOperationException ( "Unable to find the required services. Please add all the required services by calling 'IServiceCollection.{}' inside the call to 'ConfigureServices(...)' in the application startup code." ) ;
52- }
52+ }
53+ app . UseStaticFiles ( ) ;
5354
54- app . UseStaticFiles ( new StaticFileOptions
5555 {
56- FileProvider = settings . FileProvider ,
57- } ) ;
56+ var options = new StaticFileOptions
57+ {
58+ RequestPath = "" ,
59+ FileProvider = settings . FileProvider
60+ } ;
61+
62+ app . UseStaticFiles ( options ) ;
63+ }
5864 return app ;
5965 }
6066 }
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFrameworks >netstandard1.6;net451</TargetFrameworks >
4+ <TargetFrameworks >netstandard1.6;net451</TargetFrameworks >
55 <RootNamespace >Mvc.JQuery.DataTables.Common</RootNamespace >
66 <AssemblyName >Mvc.JQuery.DataTables.Common</AssemblyName >
77 <PackageId >Mvc.JQuery.DataTables.Common</PackageId >
8- <PackageVersion >1.0.0</PackageVersion >
9- <Authors >Harry McIntyre</Authors >
10- <Description >Popular lib for using DataTables.net with IQueryable. This package contain x-platform shared code. Install either Mvc.JQuery.DataTables for MVC5 or Mvc.JQuery.DataTables.AspNetCore for AspNetCore</Description >
11- <PackageRequireLicenseAcceptance >false</PackageRequireLicenseAcceptance >
12- <PackageProjectUrl >https://github.com/mcintyre321/mvc.jquery.datatables</PackageProjectUrl >
13- <Copyright >Harry McIntyre</Copyright >
14- <PackageTags >jquery datatables iqueryable razor asp mvc mvc5</PackageTags >
15- <PackageLicenseUrl >https://github.com/mcintyre321/mvc.jquery.datatables/blob/master/License.</PackageLicenseUrl >
8+ <PackageVersion >1.0.0</PackageVersion >
9+ <Authors >Harry McIntyre</Authors >
10+ <Description >Popular lib for using DataTables.net with IQueryable. This package contain x-platform shared code. Install either Mvc.JQuery.DataTables for MVC5 or Mvc.JQuery.DataTables.AspNetCore for AspNetCore</Description >
11+ <PackageRequireLicenseAcceptance >false</PackageRequireLicenseAcceptance >
12+ <PackageProjectUrl >https://github.com/mcintyre321/mvc.jquery.datatables</PackageProjectUrl >
13+ <Copyright >Harry McIntyre</Copyright >
14+ <PackageTags >jquery datatables iqueryable razor asp mvc mvc5</PackageTags >
15+ <PackageLicenseUrl >https://github.com/mcintyre321/mvc.jquery.datatables/blob/master/License.</PackageLicenseUrl >
1616 </PropertyGroup >
1717
1818 <ItemGroup >
Original file line number Diff line number Diff line change 88
99 <PackageVersion >1.0.0</PackageVersion >
1010 <Authors >Harry McIntyre</Authors >
11- <Description >Popular lib for using DataTables.net with IQueryable. Install this package to use with MVC5etCore </Description >
11+ <Description >Popular lib for using DataTables.net with IQueryable. Install this package to use with MVC5 </Description >
1212 <PackageRequireLicenseAcceptance >false</PackageRequireLicenseAcceptance >
1313 <PackageProjectUrl >https://github.com/mcintyre321/mvc.jquery.datatables</PackageProjectUrl >
1414 <Copyright >Harry McIntyre</Copyright >
1515 <PackageTags >jquery datatables iqueryable razor asp mvc mvc5</PackageTags >
16- <PackageLicenseUrl >https://github.com/mcintyre321/mvc.jquery.datatables/blob/master/License.</PackageLicenseUrl > </PropertyGroup >
16+ <PackageLicenseUrl >https://github.com/mcintyre321/mvc.jquery.datatables/blob/master/License.</PackageLicenseUrl >
17+ </PropertyGroup >
1718
1819 <ItemGroup >
1920 <PackageReference Include =" Microsoft.AspNet.Mvc" version =" 5.2.3" />
You can’t perform that action at this time.
0 commit comments