Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,94 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
<RootNamespace>Mvc.JQuery.DataTables.Example</RootNamespace>
</PropertyGroup>

<ItemGroup>
<Content Include="wwwroot\Content\jquery.dataTables.lang.de-DE.txt" />
<Content Include="wwwroot\Content\qunit-1.14.0.css" />
<Content Include="wwwroot\Content\Site.css" />
<Content Include="wwwroot\Content\themes\Aristo\images\bg_fallback.png" />
<Content Include="wwwroot\Content\themes\Aristo\images\icon_sprite.png" />
<Content Include="wwwroot\Content\themes\Aristo\images\progress_bar.gif" />
<Content Include="wwwroot\Content\themes\Aristo\images\slider_handles.png" />
<Content Include="wwwroot\Content\themes\Aristo\images\ui-icons_222222_256x240.png" />
<Content Include="wwwroot\Content\themes\Aristo\images\ui-icons_454545_256x240.png" />
<Content Include="wwwroot\Content\themes\Aristo\jquery-ui-1.8.7.custom.css" />
<Content Include="wwwroot\Content\themes\base\accordion.css" />
<Content Include="wwwroot\Content\themes\base\all.css" />
<Content Include="wwwroot\Content\themes\base\autocomplete.css" />
<Content Include="wwwroot\Content\themes\base\base.css" />
<Content Include="wwwroot\Content\themes\base\button.css" />
<Content Include="wwwroot\Content\themes\base\core.css" />
<Content Include="wwwroot\Content\themes\base\datepicker.css" />
<Content Include="wwwroot\Content\themes\base\dialog.css" />
<Content Include="wwwroot\Content\themes\base\draggable.css" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_flat_0_aaaaaa_40x100.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_flat_75_ffffff_40x100.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_glass_55_fbf9ee_1x400.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_glass_65_ffffff_1x400.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_glass_75_dadada_1x400.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_glass_75_e6e6e6_1x400.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_glass_95_fef1ec_1x400.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-bg_highlight-soft_75_cccccc_1x100.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-icons_222222_256x240.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-icons_2e83ff_256x240.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-icons_454545_256x240.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-icons_888888_256x240.png" />
<Content Include="wwwroot\Content\themes\base\images\ui-icons_cd0a0a_256x240.png" />
<Content Include="wwwroot\Content\themes\base\jquery-ui.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.accordion.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.all.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.autocomplete.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.base.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.button.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.core.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.datepicker.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.dialog.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.progressbar.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.resizable.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.selectable.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.slider.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.tabs.css" />
<Content Include="wwwroot\Content\themes\base\jquery.ui.theme.css" />
<Content Include="wwwroot\Content\themes\base\menu.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery-ui.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.accordion.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.all.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.autocomplete.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.base.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.button.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.core.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.datepicker.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.dialog.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.progressbar.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.resizable.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.selectable.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.slider.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.tabs.min.css" />
<Content Include="wwwroot\Content\themes\base\minified\jquery.ui.theme.min.css" />
<Content Include="wwwroot\Content\themes\base\progressbar.css" />
<Content Include="wwwroot\Content\themes\base\resizable.css" />
<Content Include="wwwroot\Content\themes\base\selectable.css" />
<Content Include="wwwroot\Content\themes\base\selectmenu.css" />
<Content Include="wwwroot\Content\themes\base\slider.css" />
<Content Include="wwwroot\Content\themes\base\sortable.css" />
<Content Include="wwwroot\Content\themes\base\spinner.css" />
<Content Include="wwwroot\Content\themes\base\tabs.css" />
<Content Include="wwwroot\Content\themes\base\theme.css" />
<Content Include="wwwroot\Content\themes\base\tooltip.css" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.*" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.0.*" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.*" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.*" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
Expand Down
38 changes: 36 additions & 2 deletions Mvc.JQuery.DataTables.AspNetCore/DataTablesModelBinder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.ModelBinding.Internal;
using System;
using System.Threading.Tasks;

Expand Down Expand Up @@ -99,9 +100,42 @@ private DataTablesParam BindLegacyModel(IValueProvider valueProvider, int column
private static T GetValue<T>(IValueProvider valueProvider, string key)
{
ValueProviderResult valueResult = valueProvider.GetValue(key);
return (valueResult==null)
return (valueResult == null)
? default(T)
: (T)valueResult.ConvertTo(typeof(T));
: ConvertTo<T>(valueResult);
}

/// <summary>
/// Attempts to convert the values in <paramref name="result"/> to the specified type.
/// </summary>
/// <typeparam name="T">The <see cref="Type"/> for conversion.</typeparam>
/// <param name="result">The <see cref="ValueProviderResult"/>.</param>
/// <returns>
/// The converted value, or the default value of <typeparamref name="T"/> if the value could not be converted.
/// </returns>
/// <remarks>
/// Copyright (c) .NET Foundation and Contributors
/// All rights reserved.
/// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
/// this file except in compliance with the License.You may obtain a copy of the license at:
/// http://www.apache.org/licenses/LICENSE-2.0
/// Unless required by applicable law or agreed to in writing, software distributed
/// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
/// CONDITIONS OF ANY KIND, either express or implied. See the License for the
/// specific language governing permissions and limitations under the License.
/// </remarks>
private static T ConvertTo<T>(ValueProviderResult result)
{
object valueToConvert = null;
if (result.Values.Count == 1)
{
valueToConvert = result.Values[0];
}
else if (result.Values.Count > 1)
{
valueToConvert = result.Values.ToArray();
}
return ModelBindingHelper.ConvertTo<T>(valueToConvert, result.Culture);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.6;net451</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<RootNamespace>Mvc.JQuery.DataTables</RootNamespace>
<AssemblyName>Mvc.JQuery.DataTables.AspNetCore</AssemblyName>
<PackageId>Mvc.JQuery.DataTables.AspNetCore</PackageId>
Expand All @@ -16,9 +16,9 @@
<PackageLicenseUrl>https://github.com/mcintyre321/mvc.jquery.datatables/blob/master/License.txt</PackageLicenseUrl> </PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.*" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.*" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="2.0.*" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="System.ComponentModel.Annotations" Version="4.1.0" />
<PackageReference Include="System.ComponentModel.Primitives" Version="4.1.0" />
<PackageReference Include="System.Reflection" Version="4.1.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.1.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
<PackageReference Include="System.ComponentModel.Annotations" Version="4.1.0" />
<PackageReference Include="System.ComponentModel.Primitives" Version="4.1.0" />
<PackageReference Include="System.Reflection" Version="4.1.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.1.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
Expand Down