changed to .net standard.
This commit is contained in:
parent
f6ce5a45af
commit
8396e24305
@ -1,64 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{15587E3C-D4BB-474C-A4AC-4E6305F92BCE}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>PoweredSoft.DynamicLinq.EntityFramework</RootNamespace>
|
|
||||||
<AssemblyName>PoweredSoft.DynamicLinq.EntityFramework</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
<PackageReference Include="EntityFramework" Version="6.2.0" />
|
||||||
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Extensions\DbContextExtensions.cs" />
|
<ProjectReference Include="..\PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<Folder Include="Properties\" />
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj">
|
|
||||||
<Project>{2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}</Project>
|
|
||||||
<Name>PoweredSoft.DynamicLinq</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
</Project>
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("PoweredSoft.DynamicLinq.EntityFramework")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("PoweredSoft.DynamicLinq.EntityFramework")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("15587e3c-d4bb-474c-a4ac-4e6305f92bce")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -3,13 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.27130.2010
|
VisualStudioVersion = 15.0.27130.2010
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq", "PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj", "{2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq", "PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj", "{5BB7E50F-8B40-4512-88DC-4B3BD89C9A5E}"
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Dal", "PoweredSoft.DynamicLinq.Dal\PoweredSoft.DynamicLinq.Dal.csproj", "{C16927E7-1358-4B9D-BDD7-149E505DE6CC}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Test", "PoweredSoft.DynamicLinq.Test\PoweredSoft.DynamicLinq.Test.csproj", "{6F5C80F0-9045-4098-913F-7BDAD135E6DD}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Test", "PoweredSoft.DynamicLinq.Test\PoweredSoft.DynamicLinq.Test.csproj", "{6F5C80F0-9045-4098-913F-7BDAD135E6DD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.EntityFramework", "PoweredSoft.DynamicLinq.EntityFramework\PoweredSoft.DynamicLinq.EntityFramework.csproj", "{15587E3C-D4BB-474C-A4AC-4E6305F92BCE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Dal", "PoweredSoft.DynamicLinq.Dal\PoweredSoft.DynamicLinq.Dal.csproj", "{C16927E7-1358-4B9D-BDD7-149E505DE6CC}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.EntityFramework", "PoweredSoft.DynamicLinq.EntityFramework\PoweredSoft.DynamicLinq.EntityFramework.csproj", "{82DADDB0-4A69-4E19-82AD-E73ABC8F1B4A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -17,27 +17,27 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{5BB7E50F-8B40-4512-88DC-4B3BD89C9A5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{5BB7E50F-8B40-4512-88DC-4B3BD89C9A5E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{5BB7E50F-8B40-4512-88DC-4B3BD89C9A5E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}.Release|Any CPU.Build.0 = Release|Any CPU
|
{5BB7E50F-8B40-4512-88DC-4B3BD89C9A5E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6F5C80F0-9045-4098-913F-7BDAD135E6DD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{15587E3C-D4BB-474C-A4AC-4E6305F92BCE}.Release|Any CPU.Build.0 = Release|Any CPU
|
{C16927E7-1358-4B9D-BDD7-149E505DE6CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{82DADDB0-4A69-4E19-82AD-E73ABC8F1B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{82DADDB0-4A69-4E19-82AD-E73ABC8F1B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{82DADDB0-4A69-4E19-82AD-E73ABC8F1B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{82DADDB0-4A69-4E19-82AD-E73ABC8F1B4A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {DC29EF19-8131-41DC-943F-813CF103F7E9}
|
SolutionGuid = {EBCBC23C-D682-4818-A7AA-4142BF6989C2}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -32,6 +32,12 @@ namespace PoweredSoft.DynamicLinq
|
|||||||
All
|
All
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum QuerySortDirection
|
||||||
|
{
|
||||||
|
Ascending,
|
||||||
|
Descending
|
||||||
|
}
|
||||||
|
|
||||||
internal static class Constants
|
internal static class Constants
|
||||||
{
|
{
|
||||||
internal static readonly MethodInfo ContainsMethod = typeof(string).GetMethod("Contains");
|
internal static readonly MethodInfo ContainsMethod = typeof(string).GetMethod("Contains");
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
using PoweredSoft.DynamicLinq.Helpers;
|
using PoweredSoft.DynamicLinq.Helpers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -29,10 +28,10 @@ namespace PoweredSoft.DynamicLinq.Extensions
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IQueryable<T> Sort<T>(this IQueryable<T> query, string path, SortOrder sortOrder, bool appendSort)
|
public static IQueryable<T> Sort<T>(this IQueryable<T> query, string path, QuerySortDirection sortDirection, bool appendSort)
|
||||||
{
|
{
|
||||||
var qb = new QueryBuilder<T>(query);
|
var qb = new QueryBuilder<T>(query);
|
||||||
qb.Sort(path, sortOrder, appendSort);
|
qb.Sort(path, sortDirection, appendSort);
|
||||||
var ret = qb.Build();
|
var ret = qb.Build();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using PoweredSoft.DynamicLinq.Helpers;
|
using PoweredSoft.DynamicLinq.Helpers;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -38,7 +37,7 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
|||||||
{
|
{
|
||||||
Sorts.ForEach(sort =>
|
Sorts.ForEach(sort =>
|
||||||
{
|
{
|
||||||
query = QueryableHelpers.CreateSortExpression(query, sort.Path, sort.SortOrder, sort.AppendSort);
|
query = QueryableHelpers.CreateSortExpression(query, sort.Path, sort.sortDirection, sort.AppendSort);
|
||||||
});
|
});
|
||||||
|
|
||||||
return query;
|
return query;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.CodeDom;
|
using System.CodeDom;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -39,12 +38,12 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual QueryBuilderBase Sort(string path, SortOrder sortOrder, bool appendSort)
|
public virtual QueryBuilderBase Sort(string path, QuerySortDirection sortDirection, bool appendSort)
|
||||||
{
|
{
|
||||||
Sorts.Add(new QueryBuilderSort
|
Sorts.Add(new QueryBuilderSort
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
SortOrder = sortOrder,
|
sortDirection = sortDirection,
|
||||||
AppendSort = appendSort
|
AppendSort = appendSort
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
@ -91,7 +90,7 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
|||||||
Sorts.Add(new QueryBuilderSort
|
Sorts.Add(new QueryBuilderSort
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
SortOrder = SortOrder.Ascending,
|
sortDirection = QuerySortDirection.Ascending,
|
||||||
AppendSort = false
|
AppendSort = false
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
@ -103,7 +102,7 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
|||||||
Sorts.Add(new QueryBuilderSort
|
Sorts.Add(new QueryBuilderSort
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
SortOrder = SortOrder.Descending,
|
sortDirection = QuerySortDirection.Descending,
|
||||||
AppendSort = false
|
AppendSort = false
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
@ -114,7 +113,7 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
|||||||
Sorts.Add(new QueryBuilderSort
|
Sorts.Add(new QueryBuilderSort
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
SortOrder = SortOrder.Ascending,
|
sortDirection = QuerySortDirection.Ascending,
|
||||||
AppendSort = true
|
AppendSort = true
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
@ -125,7 +124,7 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
|||||||
Sorts.Add(new QueryBuilderSort
|
Sorts.Add(new QueryBuilderSort
|
||||||
{
|
{
|
||||||
Path = path,
|
Path = path,
|
||||||
SortOrder = SortOrder.Descending,
|
sortDirection = QuerySortDirection.Descending,
|
||||||
AppendSort = true
|
AppendSort = true
|
||||||
});
|
});
|
||||||
return this;
|
return this;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -11,7 +10,7 @@ namespace PoweredSoft.DynamicLinq.Fluent
|
|||||||
{
|
{
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
public SortOrder SortOrder { get; set; } = SortOrder.Ascending;
|
public QuerySortDirection sortDirection { get; set; } = QuerySortDirection.Ascending;
|
||||||
|
|
||||||
public bool AppendSort { get; set; }
|
public bool AppendSort { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -96,13 +95,13 @@ namespace PoweredSoft.DynamicLinq.Helpers
|
|||||||
throw new NotSupportedException($"{convertStrategy} supplied is not recognized");
|
throw new NotSupportedException($"{convertStrategy} supplied is not recognized");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IQueryable<T> CreateSortExpression<T>(IQueryable<T> query, string sortPath, SortOrder sortOrder, bool appendSort = true)
|
public static IQueryable<T> CreateSortExpression<T>(IQueryable<T> query, string sortPath, QuerySortDirection sortDirection, bool appendSort = true)
|
||||||
{
|
{
|
||||||
var parameter = Expression.Parameter(typeof(T), "t");
|
var parameter = Expression.Parameter(typeof(T), "t");
|
||||||
var member = QueryableHelpers.ResolvePathForExpression(parameter, sortPath);
|
var member = QueryableHelpers.ResolvePathForExpression(parameter, sortPath);
|
||||||
|
|
||||||
string sortCommand = null;
|
string sortCommand = null;
|
||||||
if (sortOrder == SortOrder.Descending)
|
if (sortDirection == QuerySortDirection.Descending)
|
||||||
sortCommand = appendSort == false ? "OrderByDescending" : "ThenByDescending";
|
sortCommand = appendSort == false ? "OrderByDescending" : "ThenByDescending";
|
||||||
else
|
else
|
||||||
sortCommand = appendSort == false ? "OrderBy" : "ThenBy";
|
sortCommand = appendSort == false ? "OrderBy" : "ThenBy";
|
||||||
|
@ -1,56 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<ProjectGuid>{2ABC5A60-B549-4ECD-BEF4-31CA7BA4EF06}</ProjectGuid>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
|
||||||
<RootNamespace>PoweredSoft.DynamicLinq</RootNamespace>
|
|
||||||
<AssemblyName>PoweredSoft.DynamicLinq</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<TargetFrameworkProfile />
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Folder Include="Properties\" />
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Net.Http" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include="Constants.cs" />
|
|
||||||
<Compile Include="Extensions\QueryableExtensions.cs" />
|
|
||||||
<Compile Include="Fluent\QueryBuilderBase.cs" />
|
|
||||||
<Compile Include="Fluent\QueryBuilderSort.cs" />
|
|
||||||
<Compile Include="Helpers\QueryableHelpers.cs" />
|
|
||||||
<Compile Include="Helpers\TypeHelpers.cs" />
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Fluent\QueryBuilder.cs" />
|
|
||||||
<Compile Include="Fluent\QueryBuilderFilter.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
|
||||||
</Project>
|
</Project>
|
@ -1,36 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("PoweredSoft.DynamicLinq")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("PoweredSoft.DynamicLinq")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("2abc5a60-b549-4ecd-bef4-31ca7ba4ef06")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
|
||||||
[assembly: AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
Loading…
Reference in New Issue
Block a user