Skip to content

Commit 94b29dc

Browse files
authored
Merge pull request #12 from yv989c/develop
Refactoring, perf, and more
2 parents 34a0a01 + 62deffc commit 94b29dc

27 files changed

+1695
-1028
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- develop
7+
- 'feature/**'
78
paths:
89
- 'src/**'
910
- 'Version.xml'
@@ -42,7 +43,7 @@ jobs:
4243
- name: Setup .NET 6
4344
uses: actions/setup-dotnet@v1
4445
with:
45-
dotnet-version: 6.0.100
46+
dotnet-version: 6.0.x
4647
- name: Restore
4748
run: dotnet restore BlazarTech.QueryableValues.sln
4849
- name: Test All

BlazarTech.QueryableValues.sln

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,13 @@ Global
5959
{D1CA4475-6B32-4FA0-AE9A-3571EB6CFFD0}.Test|Any CPU.ActiveCfg = Test|Any CPU
6060
{D1CA4475-6B32-4FA0-AE9A-3571EB6CFFD0}.Test|Any CPU.Build.0 = Test|Any CPU
6161
{31B4ED05-9246-42AE-8DEE-8247E1906993}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62-
{31B4ED05-9246-42AE-8DEE-8247E1906993}.Debug|Any CPU.Build.0 = Debug|Any CPU
6362
{31B4ED05-9246-42AE-8DEE-8247E1906993}.Release|Any CPU.ActiveCfg = Release|Any CPU
64-
{31B4ED05-9246-42AE-8DEE-8247E1906993}.Release|Any CPU.Build.0 = Release|Any CPU
6563
{31B4ED05-9246-42AE-8DEE-8247E1906993}.Test_All|Any CPU.ActiveCfg = Test_All|Any CPU
6664
{31B4ED05-9246-42AE-8DEE-8247E1906993}.Test|Any CPU.ActiveCfg = Test|Any CPU
6765
{6020F352-30C6-4EE4-AAB9-4B376B20E5CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
68-
{6020F352-30C6-4EE4-AAB9-4B376B20E5CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
6966
{6020F352-30C6-4EE4-AAB9-4B376B20E5CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
7067
{6020F352-30C6-4EE4-AAB9-4B376B20E5CB}.Test_All|Any CPU.ActiveCfg = Test|Any CPU
71-
{6020F352-30C6-4EE4-AAB9-4B376B20E5CB}.Test_All|Any CPU.Build.0 = Test|Any CPU
7268
{6020F352-30C6-4EE4-AAB9-4B376B20E5CB}.Test|Any CPU.ActiveCfg = Test|Any CPU
73-
{6020F352-30C6-4EE4-AAB9-4B376B20E5CB}.Test|Any CPU.Build.0 = Test|Any CPU
7469
{3DF91CBD-4828-4590-80D7-501C898BE42A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7570
{3DF91CBD-4828-4590-80D7-501C898BE42A}.Debug|Any CPU.Build.0 = Debug|Any CPU
7671
{3DF91CBD-4828-4590-80D7-501C898BE42A}.Release|Any CPU.ActiveCfg = Release|Any CPU

LICENSE.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
MIT License
22

3-
Copyright (c) 2021 Carlos Villegas
3+
Copyright (c) Carlos Villegas
44

5-
Contains portions of LINQKit (https://github.com/scottksmith95/LINQKit). Copyright (c) 2007-2019 Joseph Albahari, Tomas Petricek, Scott Smith.
5+
Contains portions of:
6+
- [LINQKit](https://github.com/scottksmith95/LINQKit). Copyright (c) 2007-2019 Joseph Albahari, Tomas Petricek, Scott Smith.
7+
- [.NET Runtime](https://github.com/dotnet/runtime). Copyright (c) .NET Foundation and Contributors.
68

79
Permission is hereby granted, free of charge, to any person obtaining a copy
810
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 126 additions & 110 deletions
Large diffs are not rendered by default.

Version.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionEFCore3>3.3.0</VersionEFCore3>
4-
<VersionEFCore5>5.3.0</VersionEFCore5>
5-
<VersionEFCore6>6.3.0</VersionEFCore6>
3+
<VersionEFCore3>3.4.0</VersionEFCore3>
4+
<VersionEFCore5>5.4.0</VersionEFCore5>
5+
<VersionEFCore6>6.4.0</VersionEFCore6>
66
</PropertyGroup>
7-
<!--4a1164f5-e747-41d5-b575-cbd08bdbedbd-->
87
</Project>

docs/README.md

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# QueryableValues
22

3-
This library allows you to efficiently compose an [IEnumerable<T>] in your [Entity Framework Core] queries when using the [SQL Server Database Provider]. This is accomplished by using the `AsQueryableValues` extension method available on the [DbContext] class. Everything is evaluated on the server with a single round trip, in a way that preserves the query's [execution plan], even when the values behind the [IEnumerable<T>] are changed on subsequent executions.
3+
[![MIT License](https://badgen.net/badge/license/MIT/blue)](https://github.com/yv989c/BlazarTech.QueryableValues/blob/main/LICENSE.md)
4+
[![GitHub Stars](https://badgen.net/github/stars/yv989c/BlazarTech.QueryableValues?icon=github)][Repository]
5+
[![Nuget Downloads](https://badgen.net/nuget/dt/BlazarTech.QueryableValues.SqlServer?icon=nuget)][NuGet Package]
6+
7+
This library allows you to efficiently compose an [IEnumerable&lt;T&gt;] in your [Entity Framework Core] queries when using the [SQL Server Database Provider]. This is accomplished by using the `AsQueryableValues` extension method available on the [DbContext] class. Everything is evaluated on the server with a single round trip, in a way that preserves the query's [execution plan], even when the values behind the [IEnumerable&lt;T&gt;] are changed on subsequent executions.
48

59
The supported types for `T` are:
610
- Simple Type: [Byte], [Int16], [Int32], [Int64], [Decimal], [Single], [Double], [DateTime], [DateTimeOffset], [Guid], [Char], and [String].
@@ -9,27 +13,34 @@ The supported types for `T` are:
913
- Can be a user-defined class or struct with read/write properties and a public constructor.
1014
- Must have one or more simple type properties, including [Boolean].
1115

12-
For a detailed explanation, please continue reading [here][readme-background].
16+
For a detailed explanation of the problem solved by QueryableValues, please continue reading [here][readme-background].
1317

1418
## When Should You Use It?
1519
The `AsQueryableValues` extension method is intended for queries that are dependent upon a *non-constant* sequence of external values. In such cases, the underlying SQL query will be efficient on subsequent executions.
1620

1721
It provides a solution to the following long standing [EF Core issue](https://github.com/dotnet/efcore/issues/13617) and enables other currently unsupported scenarios; like the ability to efficiently create joins with in-memory data.
1822

19-
## Getting Started
23+
## Your Support is Appreciated!
24+
If you feel that this solution has provided you some value, please consider [buying me a ☕][BuyMeACoffee].
25+
26+
[![Buy me a coffee][BuyMeACoffeeButton]][BuyMeACoffee]
27+
28+
Your ⭐ on [this repository][Repository] also helps! Thanks! 🖖🙂
29+
30+
# Getting Started
2031

21-
### Installation
32+
## Installation
2233
QueryableValues is distributed as a [NuGet Package]. The major version number of this library is aligned with the version of [Entity Framework Core] by which it's supported (e.g. If you are using EF Core 5, then you must use version 5 of QueryableValues).
2334

2435
Please choose the appropriate command below to install it using the NuGet Package Manager Console window in Visual Studio:
2536

2637
EF Core | Command
2738
:---: | ---
28-
3.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 3.3.0`
29-
5.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 5.3.0`
30-
6.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 6.3.0`
39+
3.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 3.4.0`
40+
5.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 5.4.0`
41+
6.x | `Install-Package BlazarTech.QueryableValues.SqlServer -Version 6.4.0`
3142

32-
### Configuration
43+
## Configuration
3344
Look for the place in your code where you are setting up your [DbContext] and calling the [UseSqlServer] extension method, then use a lambda expression to access the `SqlServerDbContextOptionsBuilder` provided by it. It is on this builder that you must call the `UseQueryableValues` extension method as shown in the following simplified examples:
3445

3546
When using the `OnConfiguring` method inside your [DbContext]:
@@ -71,15 +82,15 @@ public class Startup
7182
}
7283
```
7384

74-
### How Do You Use It?
85+
## How Do You Use It?
7586
The `AsQueryableValues` extension method is provided by the `BlazarTech.QueryableValues` namespace; therefore, you must add the following `using` directive to your source code file for it to appear as a method of your [DbContext] instance:
7687
```
7788
using BlazarTech.QueryableValues;
7889
```
7990

80-
Below are a few examples composing a query using the values provided by an [IEnumerable<T>].
91+
Below are a few examples composing a query using the values provided by an [IEnumerable&lt;T&gt;].
8192

82-
#### Simple Type Examples
93+
### Simple Type Examples
8394
Using the [Contains][ContainsQueryable] LINQ method:
8495

8596
```c#
@@ -108,7 +119,7 @@ var myQuery2 =
108119
{
109120
i.MyEntityID,
110121
i.PropA
111-
});
122+
};
112123
```
113124
Using the [Join] LINQ method:
114125
```c#
@@ -136,9 +147,9 @@ var myQuery2 =
136147
{
137148
i.MyEntityID,
138149
i.PropA
139-
});
150+
};
140151
```
141-
#### Complex Type Example
152+
### Complex Type Example
142153
```c#
143154
// Performance Tip:
144155
// If your IEnumerable<T> item type (T) has many properties, project only
@@ -160,7 +171,7 @@ var myQuery =
160171
> :warning: There is a limit of up to 10 properties for any given simple type (e.g. cannot have more than 10 [Int32] properties). Exceeding that limit will cause an exception and may also suggest that you should rethink your strategy.
161172
162173
## Do You Want To Know More? 📚
163-
Please take a look at the [repository](https://github.com/yv989c/BlazarTech.QueryableValues).
174+
Please take a look at the [repository][Repository].
164175

165176

166177
[Entity Framework Core]: https://docs.microsoft.com/en-us/ef/core/
@@ -172,8 +183,8 @@ Please take a look at the [repository](https://github.com/yv989c/BlazarTech.Quer
172183
[UseSqlServer]: https://docs.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.sqlserverdbcontextoptionsextensions.usesqlserver
173184
[sp_executesql]: https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-executesql-transact-sql
174185
[SqlCommand]: https://docs.microsoft.com/en-us/dotnet/api/microsoft.data.sqlclient.sqlcommand
175-
[IEnumerable<T>]: https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable
176-
[IQueryable<T>]: https://docs.microsoft.com/en-us/dotnet/api/system.linq.iqueryable-1
186+
[IEnumerable&lt;T&gt;]: https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerable
187+
[IQueryable&lt;T&gt;]: https://docs.microsoft.com/en-us/dotnet/api/system.linq.iqueryable-1
177188
[NuGet Package]: https://www.nuget.org/packages/BlazarTech.QueryableValues.SqlServer/
178189
[readme-background]: https://github.com/yv989c/BlazarTech.QueryableValues#background-
179190
[execution plan]: https://docs.microsoft.com/en-us/sql/relational-databases/query-processing-architecture-guide?#execution-plan-caching-and-reuse
@@ -190,3 +201,6 @@ Please take a look at the [repository](https://github.com/yv989c/BlazarTech.Quer
190201
[Guid]: https://docs.microsoft.com/en-us/dotnet/api/system.guid
191202
[Char]: https://docs.microsoft.com/en-us/dotnet/api/system.char
192203
[String]: https://docs.microsoft.com/en-us/dotnet/api/system.string
204+
[BuyMeACoffee]: https://www.buymeacoffee.com/yv989c
205+
[BuyMeACoffeeButton]: https://raw.githubusercontent.com/yv989c/BlazarTech.QueryableValues/develop/docs/images/bmc-48.svg
206+
[Repository]: https://github.com/yv989c/BlazarTech.QueryableValues

0 commit comments

Comments
 (0)