Merge pull request #7 from PoweredSoft/feature/ef63-and-efcore3-alpha
Feature/ef63 and efcore3 alpha
This commit is contained in:
commit
bef5d4998c
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
@ -8,9 +8,10 @@
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>PoweredSoft.DynamicLinq.ConsoleApp</RootNamespace>
|
||||
<AssemblyName>PoweredSoft.DynamicLinq.ConsoleApp</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@ -53,10 +54,6 @@
|
||||
<Project>{c16927e7-1358-4b9d-bdd7-149e505de6cc}</Project>
|
||||
<Name>PoweredSoft.DynamicLinq.Dal</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq.Test\PoweredSoft.DynamicLinq.Test.csproj">
|
||||
<Project>{6f5c80f0-9045-4098-913f-7bdad135e6dd}</Project>
|
||||
<Name>PoweredSoft.DynamicLinq.Test</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj">
|
||||
<Project>{5bb7e50f-8b40-4512-88dc-4b3bd89c9a5e}</Project>
|
||||
<Name>PoweredSoft.DynamicLinq</Name>
|
||||
|
@ -14,8 +14,7 @@ namespace PoweredSoft.DynamicLinq.ConsoleApp
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var selectTests = new SelectTests();
|
||||
selectTests.SelectNullChecking2();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace PoweredSoft.DynamicLinq.Dal
|
||||
{
|
||||
|
||||
public class BlogContext : DbContext
|
||||
{
|
||||
public DbSet<Author> Authors { get; set; }
|
||||
|
22
PoweredSoft.DynamicLinq.Dal/BlogCoreContext.cs
Normal file
22
PoweredSoft.DynamicLinq.Dal/BlogCoreContext.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using PoweredSoft.DynamicLinq.Dal.Pocos;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using JetBrains.Annotations;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace PoweredSoft.DynamicLinq.Dal
|
||||
{
|
||||
public class BlogCoreContext : DbContext
|
||||
{
|
||||
public BlogCoreContext([NotNull] DbContextOptions options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
protected BlogCoreContext()
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<Author> Authors { get; set; }
|
||||
public DbSet<Comment> Comments { get; set; }
|
||||
public DbSet<Post> Posts { get; set; }
|
||||
}
|
||||
}
|
@ -1,67 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C16927E7-1358-4B9D-BDD7-149E505DE6CC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PoweredSoft.DynamicLinq.Dal</RootNamespace>
|
||||
<AssemblyName>PoweredSoft.DynamicLinq.Dal</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>
|
||||
<TargetFrameworks>netstandard2.1</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<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" />
|
||||
<PackageReference Include="EntityFramework" Version="6.3.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="BlogContext.cs" />
|
||||
<Compile Include="Configurations\Configurations.cs" />
|
||||
<Compile Include="Pocos\Uniqe.cs" />
|
||||
<Compile Include="Pocos\Website.cs" />
|
||||
<Compile Include="Pocos\CommentLike.cs" />
|
||||
<Compile Include="Pocos\Post.cs" />
|
||||
<Compile Include="Pocos\Author.cs" />
|
||||
<Compile Include="Pocos\Comment.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
<Folder Include="Properties\" />
|
||||
</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.Dal")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PoweredSoft.DynamicLinq.Dal")]
|
||||
[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("c16927e7-1358-4b9d-bdd7-149e505de6cc")]
|
||||
|
||||
// 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")]
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFrameworks>netstandard2.1;net461</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Authors>David Lebee</Authors>
|
||||
<Company>Powered Software Inc.</Company>
|
||||
@ -10,9 +10,9 @@
|
||||
<RepositoryUrl>https://github.com/PoweredSoft/DynamicLinq</RepositoryUrl>
|
||||
<PackageTags>entity framework ef dynamic linq</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/PoweredSoft/DynamicLinq</PackageProjectUrl>
|
||||
<Version>1.1.8</Version>
|
||||
<AssemblyVersion>1.1.8.0</AssemblyVersion>
|
||||
<FileVersion>1.1.8.0</FileVersion>
|
||||
<Version>1.1.9</Version>
|
||||
<AssemblyVersion>1.1.9.0</AssemblyVersion>
|
||||
<FileVersion>1.1.9.0</FileVersion>
|
||||
<Description>EF Integration of DynamicLinq</Description>
|
||||
<PackageId>PoweredSoft.DynamicLinq.EntityFramework</PackageId>
|
||||
<PackageReleaseNotes>Added Negate & NotContains</PackageReleaseNotes>
|
||||
@ -20,7 +20,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EntityFramework" Version="6.2.0" />
|
||||
<PackageReference Include="EntityFramework" Version="6.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.2.0" targetFramework="net462" />
|
||||
</packages>
|
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PoweredSoft.DynamicLinq.Fluent;
|
||||
|
||||
namespace PoweredSoft.DynamicLinq.EntityFrameworkCore
|
||||
{
|
||||
public static class DbContextExtensions
|
||||
{
|
||||
private static MethodInfo SetMethod = typeof(DbContext).GetMethod(nameof(DbContext.Set), BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
public static IQueryable Query(this DbContext context, Type pocoType, Action<WhereBuilder> callback)
|
||||
{
|
||||
var set = SetMethod.MakeGenericMethod(pocoType).Invoke(context, new object[] { });
|
||||
var queryable = set as IQueryable;
|
||||
var builder = new WhereBuilder(queryable);
|
||||
callback(builder);
|
||||
var result = builder.Build();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IQueryable<T> Query<T>(this DbContext context, Action<WhereBuilder> callback)
|
||||
where T : class
|
||||
{
|
||||
var query = context.Set<T>().AsQueryable();
|
||||
query = query.Query(callback);
|
||||
return query;
|
||||
}
|
||||
|
||||
public static IQueryable Where(this DbContext context, Type pocoType, Action<WhereBuilder> callback)
|
||||
=> context.Query(pocoType, callback);
|
||||
|
||||
public static IQueryable<T> Where<T>(this DbContext context, Action<WhereBuilder> callback)
|
||||
where T : class => context.Query<T>(callback);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
<Authors>David Lebee</Authors>
|
||||
<Company>Powered Software Inc.</Company>
|
||||
<Product>Entity Framework extensions for Dynamic Linq of PoweredSoft</Product>
|
||||
<RepositoryType>github</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/PoweredSoft/DynamicLinq</RepositoryUrl>
|
||||
<PackageTags>entity framework core efcore ef dynamic linq</PackageTags>
|
||||
<PackageProjectUrl>https://github.com/PoweredSoft/DynamicLinq</PackageProjectUrl>
|
||||
<Version>1.1.9</Version>
|
||||
<AssemblyVersion>1.1.9.0</AssemblyVersion>
|
||||
<FileVersion>1.1.9.0</FileVersion>
|
||||
<Description>EF Integration of DynamicLinq</Description>
|
||||
<PackageId>PoweredSoft.DynamicLinq.EntityFrameworkCore</PackageId>
|
||||
<PackageReleaseNotes>First Release of efcore extensions</PackageReleaseNotes>
|
||||
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
2
PoweredSoft.DynamicLinq.Test/App.config
Normal file
2
PoweredSoft.DynamicLinq.Test/App.config
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration />
|
198
PoweredSoft.DynamicLinq.Test/EntityFrameworkCoreTests.cs
Normal file
198
PoweredSoft.DynamicLinq.Test/EntityFrameworkCoreTests.cs
Normal file
@ -0,0 +1,198 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using PoweredSoft.DynamicLinq.Dal;
|
||||
using PoweredSoft.DynamicLinq.Dal.Pocos;
|
||||
using PoweredSoft.DynamicLinq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PoweredSoft.DynamicLinq.EntityFrameworkCore;
|
||||
|
||||
namespace PoweredSoft.DynamicLinq.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class EntityFrameworkCoreTests
|
||||
{
|
||||
|
||||
private BlogCoreContext GetCoreContext(string testName)
|
||||
{
|
||||
var options = new DbContextOptionsBuilder<BlogCoreContext>()
|
||||
.UseInMemoryDatabase(databaseName: testName).Options;
|
||||
return new BlogCoreContext(options);
|
||||
}
|
||||
|
||||
|
||||
public static void SeedForTests(BlogCoreContext context)
|
||||
{
|
||||
context.Authors.Add(new Author
|
||||
{
|
||||
FirstName = "David",
|
||||
LastName = "Lebee",
|
||||
Posts = new List<Post>()
|
||||
{
|
||||
new Post()
|
||||
{
|
||||
CreateTime = DateTimeOffset.Now,
|
||||
PublishTime = DateTimeOffset.Now,
|
||||
Title = "New project",
|
||||
Content = "Lots of good things coming",
|
||||
Comments = new List<Comment>()
|
||||
{
|
||||
new Comment()
|
||||
{
|
||||
DisplayName = "John Doe",
|
||||
Email = "john.doe@me.com",
|
||||
CommentText = "Very interesting",
|
||||
},
|
||||
new Comment()
|
||||
{
|
||||
DisplayName = "Nice Guy",
|
||||
Email = "nice.guy@lol.com",
|
||||
CommentText = "Best of luck!"
|
||||
}
|
||||
}
|
||||
},
|
||||
new Post()
|
||||
{
|
||||
CreateTime = DateTimeOffset.Now,
|
||||
PublishTime = null,
|
||||
Title = "The future!",
|
||||
Content = "Is Near"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
context.Authors.Add(new Author
|
||||
{
|
||||
FirstName = "Some",
|
||||
LastName = "Dude",
|
||||
Posts = new List<Post>()
|
||||
{
|
||||
new Post() {
|
||||
CreateTime = DateTimeOffset.Now,
|
||||
PublishTime = DateTimeOffset.Now,
|
||||
Title = "The One",
|
||||
Content = "And Only"
|
||||
},
|
||||
new Post()
|
||||
{
|
||||
CreateTime = DateTimeOffset.Now,
|
||||
PublishTime = DateTimeOffset.Now,
|
||||
Title = "The Two",
|
||||
Content = "And Second"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSimpleWhere()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestSimpleWhere));
|
||||
SeedForTests(context);
|
||||
|
||||
var query = context.Authors.AsQueryable();
|
||||
query = query.Where("FirstName", ConditionOperators.Equal, "David");
|
||||
var author = query.FirstOrDefault();
|
||||
Assert.IsNotNull(author);
|
||||
}
|
||||
[TestMethod]
|
||||
public void TestWhereAnd()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestWhereAnd));
|
||||
SeedForTests(context);
|
||||
|
||||
var query = context.Authors.AsQueryable();
|
||||
query = query.Query(q => q
|
||||
.Compare("FirstName", ConditionOperators.Equal, "David")
|
||||
.And("LastName", ConditionOperators.Equal, "Lebee")
|
||||
);
|
||||
|
||||
var author = query.FirstOrDefault();
|
||||
Assert.IsNotNull(author);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestWhereOr()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestWhereOr));
|
||||
SeedForTests(context);
|
||||
|
||||
var query = context.Authors.AsQueryable();
|
||||
query = query.Query(q => q
|
||||
.Compare("FirstName", ConditionOperators.Equal, "David")
|
||||
.Or("FirstName", ConditionOperators.Equal, "Some")
|
||||
);
|
||||
|
||||
var author = query.FirstOrDefault();
|
||||
Assert.IsNotNull(author);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGoingThroughSimpleNav()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestGoingThroughSimpleNav));
|
||||
SeedForTests(context);
|
||||
|
||||
var query = context.Posts.AsQueryable();
|
||||
query = query.Include("Author").Where("Author.FirstName", ConditionOperators.Contains, "David");
|
||||
var post = query.FirstOrDefault();
|
||||
Assert.AreEqual("David", post?.Author?.FirstName);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGoingThroughCollectionNav()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestGoingThroughCollectionNav));
|
||||
SeedForTests(context);
|
||||
|
||||
var query = context.Authors.AsQueryable();
|
||||
query = query.Where("Posts.Title", ConditionOperators.Contains, "New");
|
||||
var author = query.FirstOrDefault();
|
||||
|
||||
Assert.AreEqual(author?.FirstName, "David");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGoingThrough2CollectionNav()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestGoingThrough2CollectionNav));
|
||||
SeedForTests(context);
|
||||
|
||||
var query = context.Authors.AsQueryable();
|
||||
query = query.Where("Posts.Comments.Email", ConditionOperators.Contains, "@me.com");
|
||||
var author = query.FirstOrDefault();
|
||||
|
||||
Assert.AreEqual(author?.FirstName, "David");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSort()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestSort));
|
||||
SeedForTests(context);
|
||||
|
||||
var query = context.Posts.AsQueryable();
|
||||
var dq = query.OrderBy("Title").ThenByDescending("Content").ToList();
|
||||
var sq = query.OrderBy(t => t.Title).ThenByDescending(t => t.Content).ToList();
|
||||
|
||||
Assert.AreEqual(dq.Count, sq.Count);
|
||||
for (var i = 0; i < dq.Count; i++)
|
||||
Assert.AreEqual(dq[i].Id, sq[i].Id);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestContextTypeLessHelper()
|
||||
{
|
||||
var context = GetCoreContext(nameof(TestContextTypeLessHelper));
|
||||
SeedForTests(context);
|
||||
|
||||
var queryable = context.Query(typeof(Author), q => q.Compare("FirstName", ConditionOperators.Equal, "David"));
|
||||
var result = queryable.ToObjectList();
|
||||
var first = result.FirstOrDefault() as Author;
|
||||
Assert.AreEqual(first?.FirstName, "David");
|
||||
}
|
||||
}
|
||||
}
|
12
PoweredSoft.DynamicLinq.Test/GetCoreContext.cs
Normal file
12
PoweredSoft.DynamicLinq.Test/GetCoreContext.cs
Normal file
@ -0,0 +1,12 @@
|
||||
namespace PoweredSoft.DynamicLinq.Test
|
||||
{
|
||||
internal class GetCoreContext
|
||||
{
|
||||
private string v;
|
||||
|
||||
public GetCoreContext(string v)
|
||||
{
|
||||
this.v = v;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,109 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{6F5C80F0-9045-4098-913F-7BDAD135E6DD}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>PoweredSoft.DynamicLinq.Test</RootNamespace>
|
||||
<AssemblyName>PoweredSoft.DynamicLinq.Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<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>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<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="Faker, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Faker.Data.1.0.7\lib\net45\Faker.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.2.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PoweredSoft.Types, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\PoweredSoft.Types.1.0.0\lib\netstandard2.0\PoweredSoft.Types.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data" />
|
||||
<PackageReference Include="EntityFramework" Version="6.3.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="AnonymousTypeTest.cs" />
|
||||
<Compile Include="ComplexQueriesTests.cs" />
|
||||
<Compile Include="ConstantTests.cs" />
|
||||
<Compile Include="GroupingTests.cs" />
|
||||
<Compile Include="Helpers\QueryableAssert.cs" />
|
||||
<Compile Include="InTests.cs" />
|
||||
<Compile Include="SelectTests.cs" />
|
||||
<Compile Include="ShortcutTests.cs" />
|
||||
<Compile Include="SimpleQueriesTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="HelpersTests.cs" />
|
||||
<Compile Include="EntityFrameworkTests.cs" />
|
||||
<Compile Include="StringComparision.cs" />
|
||||
<Compile Include="TestData.cs" />
|
||||
<Compile Include="CountTests.cs" />
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq.Dal\PoweredSoft.DynamicLinq.Dal.csproj" />
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq.EntityFrameworkCore\PoweredSoft.DynamicLinq.EntityFrameworkCore.csproj" />
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq.EntityFramework\PoweredSoft.DynamicLinq.EntityFramework.csproj" />
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq.Dal\PoweredSoft.DynamicLinq.Dal.csproj">
|
||||
<Project>{C16927E7-1358-4B9D-BDD7-149E505DE6CC}</Project>
|
||||
<Name>PoweredSoft.DynamicLinq.Dal</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq.EntityFramework\PoweredSoft.DynamicLinq.EntityFramework.csproj">
|
||||
<Project>{15587e3c-d4bb-474c-a4ac-4e6305f92bce}</Project>
|
||||
<Name>PoweredSoft.DynamicLinq.EntityFramework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj">
|
||||
<Project>{2abc5a60-b549-4ecd-bef4-31ca7ba4ef06}</Project>
|
||||
<Name>PoweredSoft.DynamicLinq</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.2.0\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
|
||||
</Project>
|
||||
|
@ -1,20 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("PoweredSoft.DynamicLinq.Test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("PoweredSoft.DynamicLinq.Test")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("6f5c80f0-9045-4098-913f-7bdad135e6dd")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
|
||||
<package id="Faker.Data" version="1.0.7" targetFramework="net461" />
|
||||
<package id="MSTest.TestAdapter" version="1.2.0" targetFramework="net461" />
|
||||
<package id="MSTest.TestFramework" version="1.2.0" targetFramework="net461" />
|
||||
<package id="PoweredSoft.Types" version="1.0.0" targetFramework="net462" />
|
||||
</packages>
|
@ -1,24 +1,24 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2036
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29503.13
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicLinq", "PoweredSoft.DynamicLinq\PoweredSoft.DynamicLinq.csproj", "{5BB7E50F-8B40-4512-88DC-4B3BD89C9A5E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Test", "PoweredSoft.DynamicLinq.Test\PoweredSoft.DynamicLinq.Test.csproj", "{6F5C80F0-9045-4098-913F-7BDAD135E6DD}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicLinq.Test", "PoweredSoft.DynamicLinq.Test\PoweredSoft.DynamicLinq.Test.csproj", "{6F5C80F0-9045-4098-913F-7BDAD135E6DD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.Dal", "PoweredSoft.DynamicLinq.Dal\PoweredSoft.DynamicLinq.Dal.csproj", "{C16927E7-1358-4B9D-BDD7-149E505DE6CC}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicLinq.Dal", "PoweredSoft.DynamicLinq.Dal\PoweredSoft.DynamicLinq.Dal.csproj", "{C16927E7-1358-4B9D-BDD7-149E505DE6CC}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PoweredSoft.DynamicLinq.EntityFramework", "PoweredSoft.DynamicLinq.EntityFramework\PoweredSoft.DynamicLinq.EntityFramework.csproj", "{82DADDB0-4A69-4E19-82AD-E73ABC8F1B4A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.ConsoleApp", "PoweredSoft.DynamicLinq.ConsoleApp\PoweredSoft.DynamicLinq.ConsoleApp.csproj", "{A166BD89-7BF3-475B-871F-294B8A420D9E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{77B4027B-ECB0-4ED1-8646-025AC4146CE2}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
LICENSE = LICENSE
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoweredSoft.DynamicLinq.EntityFrameworkCore", "PoweredSoft.DynamicLinq.EntityFrameworkCore\PoweredSoft.DynamicLinq.EntityFrameworkCore.csproj", "{BBF5805B-560C-474B-885B-9202281B42F7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -41,10 +41,10 @@ Global
|
||||
{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
|
||||
{A166BD89-7BF3-475B-871F-294B8A420D9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A166BD89-7BF3-475B-871F-294B8A420D9E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A166BD89-7BF3-475B-871F-294B8A420D9E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A166BD89-7BF3-475B-871F-294B8A420D9E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BBF5805B-560C-474B-885B-9202281B42F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BBF5805B-560C-474B-885B-9202281B42F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BBF5805B-560C-474B-885B-9202281B42F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BBF5805B-560C-474B-885B-9202281B42F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -11,9 +11,9 @@
|
||||
<RepositoryUrl>https://github.com/PoweredSoft/DynamicLinq</RepositoryUrl>
|
||||
<RepositoryType>github</RepositoryType>
|
||||
<PackageTags>dynamic linq queryable</PackageTags>
|
||||
<AssemblyVersion>1.1.8.0</AssemblyVersion>
|
||||
<FileVersion>1.1.8.0</FileVersion>
|
||||
<Version>1.1.8</Version>
|
||||
<AssemblyVersion>1.1.9.0</AssemblyVersion>
|
||||
<FileVersion>1.1.9.0</FileVersion>
|
||||
<Version>1.1.9</Version>
|
||||
<PackageProjectUrl>https://github.com/PoweredSoft/DynamicLinq</PackageProjectUrl>
|
||||
<PackageId>PoweredSoft.DynamicLinq</PackageId>
|
||||
<PackageReleaseNotes>Added not contains thanks to Jon-Galloway.
|
||||
|
Loading…
Reference in New Issue
Block a user