Skip to content

Commit e1a86c0

Browse files
authored
Merge pull request #17 from yv989c/develop
Enhancements
2 parents ee33396 + 33ecd5b commit e1a86c0

19 files changed

+327
-66
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,46 @@ on:
1515
release:
1616
types:
1717
- published
18+
19+
# Allows you to run this workflow manually from the Actions tab
20+
workflow_dispatch:
21+
1822
env:
19-
# Stop wasting time caching packages
2023
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
21-
# Disable sending usage data to Microsoft
2224
DOTNET_CLI_TELEMETRY_OPTOUT: true
23-
# Project name to pack and publish
24-
PROJECT_NAME: BlazarTech.QueryableValues.SqlServer
25+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
26+
2527
# GitHub Packages Feed settings
2628
GITHUB_FEED: https://nuget.pkg.github.com/yv989c/index.json
2729
GITHUB_USER: yv989c
2830
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2931
LOCAL_NUGET_PAT: ${{ secrets.LOCAL_NUGET_PAT }}
32+
3033
# Official NuGet Feed settings
3134
NUGET_FEED: https://api.nuget.org/v3/index.json
3235
NUGET_USER: yv989c
3336
NUGET_TOKEN: ${{ secrets.NUGET_KEY }}
37+
3438
jobs:
3539
build:
36-
runs-on: ${{ matrix.os }}
37-
strategy:
38-
matrix:
39-
os: [ windows-latest ]
40+
runs-on: windows-latest
4041
steps:
4142
- name: Checkout
4243
uses: actions/checkout@v2
43-
- name: Setup .NET 6
44-
uses: actions/setup-dotnet@v1
45-
with:
46-
dotnet-version: 6.0.x
44+
4745
- name: Restore
4846
run: dotnet restore BlazarTech.QueryableValues.sln
47+
4948
- name: Test All
5049
run: dotnet test BlazarTech.QueryableValues.sln -c Test_All --no-restore
50+
5151
- name: PreRelease-Pack
5252
if: github.event_name != 'release'
5353
run: dotnet build BlazarTech.QueryableValues.SqlServer.sln -c Release --no-restore --version-suffix=build.$env:GITHUB_RUN_NUMBER
5454
- name: Release-Pack
5555
if: github.event_name == 'release'
5656
run: dotnet build BlazarTech.QueryableValues.SqlServer.sln -c Release --no-restore
57+
5758
- name: Upload Artifacts
5859
uses: actions/upload-artifact@v2
5960
with:

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img src="https://raw.githubusercontent.com/yv989c/BlazarTech.QueryableValues/develop/docs/images/icon.png" alt="Logo" style="width: 80px;">
2+
<img src="/docs/images/icon.png" alt="Logo" style="width: 80px;">
33
</p>
44

55
# QueryableValues
@@ -19,8 +19,7 @@ The supported types for `T` are:
1919

2020
For a detailed explanation of the problem solved by QueryableValues, please continue reading [here][readme-background].
2121

22-
> 💡 Still on Entity Framework 6 (non-core)?
23-
> [This Stack Overflow answer](https://stackoverflow.com/a/70587979/2206145) may be helpful.
22+
> 💡 Still on Entity Framework 6 (non-core)? Then [QueryableValues `EF6 Edition`](https://github.com/yv989c/BlazarTech.QueryableValues.EF6) is what you need.
2423
2524
## When Should You Use It?
2625
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.
@@ -92,10 +91,12 @@ public class Startup
9291

9392
## How Do You Use It?
9493
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:
95-
```
94+
```c#
9695
using BlazarTech.QueryableValues;
9796
```
9897

98+
> 💡 If you access your [DbContext] via an interface, you can also make the `AsQueryableValues` extension methods available on it by inheriting from the `IQueryableValuesEnabledDbContext` interface.
99+
99100
Below are a few examples composing a query using the values provided by an [IEnumerable&lt;T&gt;].
100101

101102
### Simple Type Examples

Version.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionEFCore3>3.4.0</VersionEFCore3>
4-
<VersionEFCore5>5.4.0</VersionEFCore5>
5-
<VersionEFCore6>6.4.0</VersionEFCore6>
6-
<VersionEFCore7>7.0.0-preview.1</VersionEFCore7>
3+
<VersionEFCore3>3.5.0</VersionEFCore3>
4+
<VersionEFCore5>5.5.0</VersionEFCore5>
5+
<VersionEFCore6>6.5.0</VersionEFCore6>
6+
<VersionEFCore7>7.0.0-preview.2</VersionEFCore7>
77
</PropertyGroup>
8-
<!--d0816a78-e3a1-44f1-9548-f02338ca15ef-->
98
</Project>

docs/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ The supported types for `T` are:
1515

1616
For a detailed explanation of the problem solved by QueryableValues, please continue reading [here][readme-background].
1717

18-
> 💡 Still on Entity Framework 6 (non-core)?
19-
> [This Stack Overflow answer](https://stackoverflow.com/a/70587979/2206145) may be helpful.
18+
> 💡 Still on Entity Framework 6 (non-core)? Then [QueryableValues `EF6 Edition`](https://github.com/yv989c/BlazarTech.QueryableValues.EF6) is what you need.
2019
2120
## When Should You Use It?
2221
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.
@@ -88,10 +87,12 @@ public class Startup
8887

8988
## How Do You Use It?
9089
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:
91-
```
90+
```c#
9291
using BlazarTech.QueryableValues;
9392
```
9493

94+
> 💡 If you access your [DbContext] via an interface, you can also make the `AsQueryableValues` extension methods available on it by inheriting from the `IQueryableValuesEnabledDbContext` interface.
95+
9596
Below are a few examples composing a query using the values provided by an [IEnumerable&lt;T&gt;].
9697

9798
### Simple Type Examples
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#if EFCORE
2+
using Microsoft.EntityFrameworkCore;
3+
4+
namespace BlazarTech.QueryableValues
5+
{
6+
/// <summary>
7+
/// Makes the <see cref="QueryableValuesDbContextExtensions"/> available on the type implementing this interface.
8+
/// </summary>
9+
/// <remarks>
10+
/// Useful when your <see cref="DbContext"/> is behind an interface.
11+
/// You can implement <see cref="IQueryableValuesEnabledDbContext"/> on that interface to make the <see cref="QueryableValuesDbContextExtensions"/> available on it.
12+
/// </remarks>
13+
public interface IQueryableValuesEnabledDbContext
14+
{
15+
}
16+
}
17+
#endif

src/QueryableValues.SqlServer/QueryableValuesDbContextExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ public static IQueryable<DateTimeOffset> AsQueryableValues(this DbContext dbCont
181181
/// </summary>
182182
/// <param name="dbContext">The <see cref="DbContext"/> owning the query.</param>
183183
/// <param name="values">The sequence of values to compose.</param>
184-
/// <param name="isUnicode">If <c>true</c>, will cast the <paramref name="values"/> as <c>nvarchar</c>, otherwise, <c>varchar</c>.</param>
184+
/// <param name="isUnicode">If <see langword="true"/>, will cast the <paramref name="values"/> as <c>nvarchar</c>, otherwise, <c>varchar</c>.</param>
185185
/// <returns>An <see cref="IQueryable{Char}">IQueryable&lt;char&gt;</see> that can be composed with other entities in the query.</returns>
186186
/// <remarks>
187187
/// About Performance: If the result is going to be composed against the property of an entity that uses
188-
/// unicode (<c>nvarchar</c>), then <paramref name="isUnicode"/> should be <c>true</c>.
188+
/// unicode (<c>nvarchar</c>), then <paramref name="isUnicode"/> should be <see langword="true"/>.
189189
/// Failing to do this may force SQL Server's query engine to do an implicit casting, which results
190190
/// in a scan instead of an index seek (assuming there's a covering index).
191191
/// </remarks>
@@ -202,11 +202,11 @@ public static IQueryable<char> AsQueryableValues(this DbContext dbContext, IEnum
202202
/// </summary>
203203
/// <param name="dbContext">The <see cref="DbContext"/> owning the query.</param>
204204
/// <param name="values">The sequence of values to compose.</param>
205-
/// <param name="isUnicode">If <c>true</c>, will cast the <paramref name="values"/> as <c>nvarchar</c>, otherwise, <c>varchar</c>.</param>
205+
/// <param name="isUnicode">If <see langword="true"/>, will cast the <paramref name="values"/> as <c>nvarchar</c>, otherwise, <c>varchar</c>.</param>
206206
/// <returns>An <see cref="IQueryable{String}">IQueryable&lt;string&gt;</see> that can be composed with other entities in the query.</returns>
207207
/// <remarks>
208208
/// About Performance: If the result is going to be composed against the property of an entity that uses
209-
/// unicode (<c>nvarchar</c>), then <paramref name="isUnicode"/> should be <c>true</c>.
209+
/// unicode (<c>nvarchar</c>), then <paramref name="isUnicode"/> should be <see langword="true"/>.
210210
/// Failing to do this may force SQL Server's query engine to do an implicit casting, which results
211211
/// in a scan instead of an index seek (assuming there's a covering index).
212212
/// </remarks>

0 commit comments

Comments
 (0)