Skip to content

Commit

Permalink
:semver:minor - return to multi-targetting (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
Philo authored Oct 8, 2019
1 parent 97f41d8 commit 7005d28
Show file tree
Hide file tree
Showing 7 changed files with 467 additions and 7 deletions.
10 changes: 10 additions & 0 deletions src/Nest.Searchify/Abstractions/IPaginationOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ public interface IPaginationOptions<out TParameters> where TParameters : IPaging
TParameters ForPage(int page);
TParameters LastPage();

#if NETSTANDARD
/// <summary>
/// Generates a group of pages around the current page, will always include
/// </summary>
/// <param name="range">the range of pages to generate, by default 5 pages either side of the current page will be generated (or the available pages if that is less than the <paramref name="range"/></param>
/// <returns>Group of page numbers along with a dictionary containing the required querystring for the page</returns>
IEnumerable<Tuple<int, Dictionary<string, Microsoft.Extensions.Primitives.StringValues>>> PagingGroup(int range = 5);
#else

/// <summary>
/// Generates a group of pages around the current page, will always include
/// </summary>
/// <param name="range">the range of pages to generate, by default 5 pages either side of the current page will be generated (or the available pages if that is less than the <paramref name="range"/></param>
/// <returns>Group of page numbers along with a dictionary containing the required querystring for the page</returns>
IEnumerable<Tuple<int, NameValueCollection>> PagingGroup(int range = 5);
#endif
}
}
13 changes: 11 additions & 2 deletions src/Nest.Searchify/Nest.Searchify.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>
<TargetFrameworks>net461;netstandard2.0</TargetFrameworks>
<AssemblyName>Nest.Searchify</AssemblyName>
<RootNamespace>Nest.Searchify</RootNamespace>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
Expand Down Expand Up @@ -43,9 +43,18 @@
<Compile Remove="Queries\GeoLocationParameter.cs" />
<Compile Remove="Queries\Models\GeoBoundingBox.cs" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="3.3.1" />
<PackageReference Include="NEST" Version="[6.8.3,7]" />
<PackageReference Include="Nest.Queryify" Version="6.0.0" />
Expand Down
15 changes: 13 additions & 2 deletions src/Nest.Searchify/Queries/ParametersQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,25 @@ public class ParametersQuery<TParameters, TDocument, TSearchResult, TOutputEntit
where TOutputEntity : class
where TSearchResult : SearchResult<TParameters, TDocument, TOutputEntity>
{
public ParametersQuery() : this(Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(""))
#if !NETSTANDARD
public ParametersQuery() : this(new System.Collections.Specialized.NameValueCollection())
{
}

public ParametersQuery(Dictionary<string, Microsoft.Extensions.Primitives.StringValues> parameters) : base(QueryStringParser<TParameters>.Parse(parameters))
public ParametersQuery(System.Collections.Specialized.NameValueCollection parameters) : base(QueryStringParser<TParameters>.Parse(parameters))
{
}
#else
public ParametersQuery() : this(Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(""))
{
}


public ParametersQuery(Dictionary<string, Microsoft.Extensions.Primitives.StringValues> parameters) : base(QueryStringParser<TParameters>.Parse(parameters))
{
}
#endif

public ParametersQuery(TParameters parameters) : base(parameters)
{
}
Expand Down
Loading

0 comments on commit 7005d28

Please sign in to comment.