Skip to content

Commit a834ec2

Browse files
authored
Merge pull request #107 from programcsharp/net-core-3.1
Net core 3.1
2 parents c4d8517 + 45ed61a commit a834ec2

File tree

198 files changed

+39629
-305
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+39629
-305
lines changed

Build/Griddly.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<projectUrl>http://griddly.com</projectUrl>
99
<iconUrl>https://raw.githubusercontent.com/programcsharp/griddly/master/Griddly/Content/griddly-32.png</iconUrl>
1010
<requireLicenseAcceptance>false</requireLicenseAcceptance>
11-
<license type="expression">MIT</license>
11+
<!--<license type="expression">MIT</license>-->
1212
<description>Pagable, sortable, MVC enabled grid</description>
1313
<language>en-US</language>
1414
<dependencies>

Build/build.proj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PackageDir>$(BuildDir)\Packages</PackageDir>
88
<SolutionFile>$(BaseDir)\Griddly.sln</SolutionFile>
99
<MSBuildExtensions>$(BaseDir)\.build\MSBuild.Community.Tasks.dll</MSBuildExtensions>
10-
<VisualStudioVersion>14.0</VisualStudioVersion>
10+
<VisualStudioVersion>16.0</VisualStudioVersion>
1111
</PropertyGroup>
1212

1313
<UsingTask AssemblyFile="$(MSBuildExtensions)" TaskName="MSBuild.Community.Tasks.XmlUpdate" />
@@ -23,7 +23,7 @@
2323
<RemoveDir Directories="$(BaseDir)\Griddly\obj" />
2424

2525
<ItemGroup>
26-
<Libs Include="$(BaseDir)\Griddly.Mvc\bin\$(Configuration)\Griddly.Mvc.dll" />
26+
<Libs Include="$(BaseDir)\Griddly.Mvc\bin\$(Configuration)\net45\Griddly.Mvc.dll" />
2727
<Content Include="$(BaseDir)\Griddly\**\griddly.js" />
2828
<Content Include="$(BaseDir)\Griddly\**\griddly.css" />
2929
<Content Include="$(BaseDir)\Griddly\**\Views\Shared\Griddly\*.*" />

Build/publish-nuget.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if(-not (test-path $keyfile)) {
2727
else {
2828
pushd $packagespath
2929

30-
# get our secret key. This is not in the repository.
30+
# get our secret key. This is not in the repository.
3131
$key = get-content $keyfile
3232

3333
# Find all the packages and display them for confirmation

Griddly.Mvc/EmptyGridMessageTemplateParams.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
6-
7-
namespace Griddly.Mvc
1+
namespace Griddly.Mvc
82
{
93
//TODO: Put GriddlySettings into GriddlyContext so that it doesn't need to be passed in separately
104
public class EmptyGridMessageTemplateParams

Griddly.Mvc/Exceptions/DapperGriddlyException.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62

73
namespace Griddly.Mvc.Exceptions
84
{

Griddly.Mvc/Griddly.Mvc.csproj

Lines changed: 19 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,30 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
43
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{B43B3EA7-F12E-45C1-8BE5-D3BE1C8DBA1F}</ProjectGuid>
8-
<OutputType>Library</OutputType>
9-
<AppDesignerFolder>Properties</AppDesignerFolder>
4+
<TargetFrameworks>netcoreapp3.1;net45</TargetFrameworks>
105
<RootNamespace>Griddly.Mvc</RootNamespace>
11-
<AssemblyName>Griddly.Mvc</AssemblyName>
12-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13-
<FileAlignment>512</FileAlignment>
14-
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
15-
<RestorePackages>true</RestorePackages>
16-
<TargetFrameworkProfile />
6+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
177
</PropertyGroup>
18-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19-
<DebugSymbols>true</DebugSymbols>
20-
<DebugType>full</DebugType>
21-
<Optimize>false</Optimize>
22-
<OutputPath>bin\Debug\</OutputPath>
23-
<DefineConstants>DEBUG;TRACE</DefineConstants>
24-
<ErrorReport>prompt</ErrorReport>
25-
<WarningLevel>4</WarningLevel>
26-
<Prefer32Bit>false</Prefer32Bit>
27-
</PropertyGroup>
28-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29-
<DebugType>pdbonly</DebugType>
30-
<Optimize>true</Optimize>
31-
<OutputPath>bin\Release\</OutputPath>
32-
<DefineConstants>TRACE</DefineConstants>
33-
<ErrorReport>prompt</ErrorReport>
34-
<WarningLevel>4</WarningLevel>
35-
<Prefer32Bit>false</Prefer32Bit>
36-
</PropertyGroup>
37-
<ItemGroup>
38-
<Reference Include="CsvHelper, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
39-
<SpecificVersion>False</SpecificVersion>
40-
<HintPath>..\packages\CsvHelper.2.4.1\lib\net40-client\CsvHelper.dll</HintPath>
41-
</Reference>
42-
<Reference Include="Dapper, Version=1.50.2.0, Culture=neutral, processorArchitecture=MSIL">
43-
<HintPath>..\packages\Dapper.1.50.2\lib\net45\Dapper.dll</HintPath>
44-
<Private>True</Private>
45-
</Reference>
46-
<Reference Include="EPPlus">
47-
<HintPath>..\packages\EPPlus.3.1.3.3\lib\net35\EPPlus.dll</HintPath>
48-
</Reference>
49-
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
50-
<Private>True</Private>
51-
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
52-
</Reference>
53-
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
54-
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
55-
</Reference>
56-
<Reference Include="System" />
8+
9+
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
10+
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.7" />
11+
5712
<Reference Include="System.ComponentModel.DataAnnotations" />
58-
<Reference Include="System.Core" />
5913
<Reference Include="System.Data.Entity.Design" />
6014
<Reference Include="System.Web" />
61-
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll</HintPath>
63-
</Reference>
64-
<Reference Include="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
65-
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll</HintPath>
66-
</Reference>
67-
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68-
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll</HintPath>
69-
</Reference>
70-
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
71-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll</HintPath>
72-
</Reference>
73-
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
74-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
75-
</Reference>
76-
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
77-
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
78-
</Reference>
79-
<Reference Include="System.Xml.Linq" />
80-
<Reference Include="System.Data.DataSetExtensions" />
81-
<Reference Include="Microsoft.CSharp" />
82-
<Reference Include="System.Data" />
83-
<Reference Include="System.Xml" />
8415
</ItemGroup>
85-
<ItemGroup>
86-
<Compile Include="..\Build\CommonAssemblyInfo.cs">
87-
<Link>Properties\CommonAssemblyInfo.cs</Link>
88-
</Compile>
89-
<Compile Include="DynamicLinq.cs" />
90-
<Compile Include="EmptyGridMessageTemplateParams.cs" />
91-
<Compile Include="Exceptions\DapperGriddlyException.cs" />
92-
<Compile Include="GriddlyContext.cs" />
93-
<Compile Include="GriddlyCookieFilterValueProvider.cs" />
94-
<Compile Include="GriddlyCss.cs" />
95-
<Compile Include="GriddlyFilterExtensions.cs" />
96-
<Compile Include="GriddlyHtmlFilter.cs" />
97-
<Compile Include="GriddlyExport.cs" />
98-
<Compile Include="GriddlyFilterBarSettings.cs" />
99-
<Compile Include="GriddlyParameterAttribute.cs" />
100-
<Compile Include="IFilterSettings.cs" />
101-
<Compile Include="InternalExtensions.cs" />
102-
<Compile Include="GriddlyButton.cs" />
103-
<Compile Include="GriddlyColumn.cs" />
104-
<Compile Include="GriddlyCsvResult.cs" />
105-
<Compile Include="GriddlyExcelResult.cs" />
106-
<Compile Include="GriddlyExtensions.cs" />
107-
<Compile Include="GriddlyFilter.cs" />
108-
<Compile Include="GriddlyHtmlButton.cs" />
109-
<Compile Include="GriddlyResult.cs" />
110-
<Compile Include="GriddlyResultPage.cs" />
111-
<Compile Include="GriddlySelectColumn.cs" />
112-
<Compile Include="GriddlySettings.cs" />
113-
<Compile Include="GriddlySettingsResult.cs" />
114-
<Compile Include="IHasOverallCount.cs" />
115-
<Compile Include="ListPage.cs" />
116-
<Compile Include="Properties\AssemblyInfo.cs" />
117-
<Compile Include="Results\DapperResult.cs" />
118-
<Compile Include="Results\DapperSql2008Result.cs" />
119-
<Compile Include="Results\DapperSql2012Result.cs" />
120-
<Compile Include="Results\MapQueryableResult.cs" />
121-
<Compile Include="Results\QueryableResult.cs" />
122-
<Compile Include="SelectListItemGroup.cs" />
123-
<Compile Include="SortField.cs" />
16+
17+
<ItemGroup Condition="$(TargetFramework.StartsWith('netcoreapp'))">
18+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor" Version="2.2.0" />
19+
<PackageReference Include="PluralizeService.Core" Version="1.0.0.5" />
20+
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.9.2" />
12421
</ItemGroup>
22+
12523
<ItemGroup>
126-
<None Include="packages.config" />
24+
<PackageReference Include="CsvHelper" Version="12.1.1" />
25+
<PackageReference Include="Dapper" Version="1.50.2" />
26+
<PackageReference Include="EPPlus" Version="4.5.3" />
27+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
12728
</ItemGroup>
128-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
129-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
130-
Other similar extension points exist, see Microsoft.Common.targets.
131-
<Target Name="BeforeBuild">
132-
</Target>
133-
<Target Name="AfterBuild">
134-
</Target>
135-
-->
29+
13630
</Project>

Griddly.Mvc/GriddlyButton.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
using System;
22
using System.Collections.Generic;
3+
#if NET45
34
using System.Web.Mvc;
5+
#else
6+
using System.Net.Http;
7+
#endif
48

59
namespace Griddly.Mvc
610
{
@@ -65,25 +69,44 @@ public GriddlyButton Add(GriddlyButton item)
6569
return this;
6670
}
6771

68-
public HttpVerbs Verb
72+
public
73+
#if NET45
74+
HttpVerbs
75+
#else
76+
HttpMethod
77+
#endif
78+
Verb
6979
{
7080
get
7181
{
7282
switch (Action)
7383
{
7484
case GriddlyButtonAction.Navigate:
85+
#if NET45
7586
return HttpVerbs.Get;
87+
#else
88+
return HttpMethod.Get;
89+
#endif
7690
case GriddlyButtonAction.Post:
7791
case GriddlyButtonAction.PostCriteria:
7892
case GriddlyButtonAction.Ajax:
7993
case GriddlyButtonAction.AjaxBulk:
94+
#if NET45
8095
return HttpVerbs.Post;
96+
#else
97+
return HttpMethod.Post;
98+
#endif
8199
default:
100+
#if NET45
82101
return HttpVerbs.Get;
102+
#else
103+
return HttpMethod.Get;
104+
#endif
83105
}
84106

85107
}
86108
}
109+
87110
}
88111

89112
public enum GriddlyButtonAction

Griddly.Mvc/GriddlyColumn.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@
44
using System.Linq.Expressions;
55
using System.Text.RegularExpressions;
66
using System.Web;
7+
#if NET45
78
using System.Web.Helpers;
89
using System.Web.Mvc;
910
using System.Web.Routing;
1011
using System.Web.WebPages;
12+
#else
13+
using Microsoft.AspNetCore.Html;
14+
using Microsoft.AspNetCore.Mvc.Razor;
15+
using Microsoft.AspNetCore.Mvc.ViewFeatures;
16+
using Microsoft.AspNetCore.Routing;
17+
#endif
1118

1219
namespace Griddly.Mvc
1320
{

Griddly.Mvc/GriddlyContext.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
63

74
namespace Griddly.Mvc
85
{

Griddly.Mvc/GriddlyCookieFilterValueProvider.cs

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
using System.Linq;
66
using System.Text;
77
using System.Threading.Tasks;
8+
#if NET45
89
using System.Web.Mvc;
10+
#else
11+
using Microsoft.AspNetCore.Mvc;
12+
using Microsoft.AspNetCore.Mvc.ModelBinding;
13+
#endif
914

1015
namespace Griddly.Mvc
1116
{
@@ -42,18 +47,23 @@ public ValueProviderResult GetValue(string key)
4247
if (value != null)
4348
attemptedValue = string.Join(",", value);
4449

50+
#if NET45
4551
return new ValueProviderResult(value, attemptedValue, CultureInfo.CurrentCulture);
52+
#else
53+
return new ValueProviderResult(value, CultureInfo.CurrentCulture);
54+
#endif
4655
}
4756
}
4857

58+
#if NET45
4959
public class GriddlyCookieFilterValueProviderFactory : ValueProviderFactory
5060
{
5161
Func<ControllerContext, bool> _canProvide = (controllerContext) => controllerContext.HttpContext.Request.QueryString.Count == 0;
5262

5363
public GriddlyCookieFilterValueProviderFactory(Func<ControllerContext, bool> canProvide = null)
5464
{
5565
if (canProvide != null)
56-
_canProvide = canProvide;
66+
_canProvide = canProvide;
5767
}
5868

5969
public override IValueProvider GetValueProvider(ControllerContext controllerContext)
@@ -90,4 +100,51 @@ public override IValueProvider GetValueProvider(ControllerContext controllerCont
90100
return null;
91101
}
92102
}
103+
#else
104+
public class GriddlyCookieFilterValueProviderFactory : IValueProviderFactory
105+
{
106+
Func<ActionContext, bool> _canProvide = (actionContext) => actionContext.HttpContext.Request.Query.Count == 0;
107+
108+
public GriddlyCookieFilterValueProviderFactory(Func<ActionContext, bool> canProvide = null)
109+
{
110+
if (canProvide != null)
111+
_canProvide = canProvide;
112+
}
113+
114+
public Task CreateValueProviderAsync(ValueProviderFactoryContext vpfc)
115+
{
116+
return Task.Factory.StartNew(() =>
117+
{
118+
if (vpfc.ActionContext.HttpContext.IsChildAction() && _canProvide.Invoke(vpfc.ActionContext))
119+
{
120+
var context = vpfc.ActionContext.GetOrCreateGriddlyContext();
121+
var cookie = vpfc.ActionContext.HttpContext.Request.Cookies[context.CookieName];
122+
123+
if (cookie != null && !string.IsNullOrWhiteSpace(cookie))
124+
{
125+
try
126+
{
127+
var data = JsonConvert.DeserializeObject<GriddlyFilterCookieData>(cookie);
128+
129+
// chrome/ff don't delete session cookies if they're set to "continue where you left off"
130+
// https://stackoverflow.com/questions/10617954/chrome-doesnt-delete-session-cookies
131+
// only use a cookie if it's new within 100 minutes
132+
if (data.CreatedUtc != null && (DateTime.UtcNow - data.CreatedUtc.Value).TotalMinutes < 100)
133+
{
134+
context.CookieData = data;
135+
context.IsDefaultSkipped = true;
136+
137+
vpfc.ValueProviders.Add(new GriddlyCookieFilterValueProvider(context));
138+
}
139+
}
140+
catch
141+
{
142+
// TODO: log it?
143+
}
144+
}
145+
}
146+
});
147+
}
148+
}
149+
#endif
93150
}

0 commit comments

Comments
 (0)