Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,17 @@ env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false

# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/yv989c/index.json
GITHUB_USER: yv989c
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOCAL_NUGET_PAT: ${{ secrets.LOCAL_NUGET_PAT }}

# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_USER: yv989c
NUGET_TOKEN: ${{ secrets.NUGET_KEY }}

jobs:
build:
runs-on: windows-latest
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6

- name: Restore
run: dotnet restore BlazarTech.QueryableValues.sln
Expand All @@ -49,36 +43,31 @@ jobs:
run: dotnet build BlazarTech.QueryableValues.SqlServer.sln -c Release --no-restore

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v6
with:
name: nupkg
path: ./src/QueryableValues.SqlServer.EFCore*/bin/Release/*.nupkg
prerelease:
needs: build
if: github.ref == 'refs/heads/develop'
runs-on: windows-latest
runs-on: windows-2022
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v7
with:
name: nupkg
- name: Push to GitHub Feed
- name: Push to NuGet Feed
run: |
dotnet nuget add source --username $env:GITHUB_USER --password $env:GITHUB_TOKEN --store-password-in-clear-text --name github "$env:GITHUB_FEED" &&
dotnet nuget push "**/*.nupkg" --api-key $env:LOCAL_NUGET_PAT --source github --skip-duplicate
dotnet nuget push "**/*.nupkg" --api-key $env:NUGET_TOKEN --source $env:NUGET_FEED --skip-duplicate
deploy:
needs: build
if: github.event_name == 'release'
runs-on: windows-latest
runs-on: windows-2022
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v7
with:
name: nupkg
- name: Push to GitHub Feed
run: |
dotnet nuget add source --username $env:GITHUB_USER --password $env:GITHUB_TOKEN --store-password-in-clear-text --name github "$env:GITHUB_FEED" &&
dotnet nuget push "**/*.nupkg" --api-key $env:LOCAL_NUGET_PAT --source github --skip-duplicate
- name: Push to NuGet Feed
run: |
dotnet nuget push "**/*.nupkg" --api-key $env:NUGET_TOKEN --source $env:NUGET_FEED --skip-duplicate
20 changes: 18 additions & 2 deletions BlazarTech.QueryableValues.SqlServer.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
# Visual Studio Version 18
VisualStudioVersion = 18.1.11304.174 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer", "src\QueryableValues.SqlServer\QueryableValues.SqlServer.csproj", "{134F124A-C234-4B36-BEAC-B50E4B4CE3FD}"
EndProject
Expand All @@ -22,6 +22,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.E
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.EFCore8", "src\QueryableValues.SqlServer.EFCore8\QueryableValues.SqlServer.EFCore8.csproj", "{91D461B8-ECE6-4852-806E-2DD17ACA3B04}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableValues.SqlServer.EFCore9", "src\QueryableValues.SqlServer.EFCore9\QueryableValues.SqlServer.EFCore9.csproj", "{B2C4FD8C-A344-B5F4-1AB6-00D900CE7E6C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableValues.SqlServer.EFCore10", "src\QueryableValues.SqlServer.EFCore10\QueryableValues.SqlServer.EFCore10.csproj", "{6636695F-C700-DD8B-DAB3-F07FAB201A72}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -64,6 +68,18 @@ Global
{91D461B8-ECE6-4852-806E-2DD17ACA3B04}.Release|Any CPU.Build.0 = Release|Any CPU
{91D461B8-ECE6-4852-806E-2DD17ACA3B04}.Test|Any CPU.ActiveCfg = Test|Any CPU
{91D461B8-ECE6-4852-806E-2DD17ACA3B04}.Test|Any CPU.Build.0 = Test|Any CPU
{B2C4FD8C-A344-B5F4-1AB6-00D900CE7E6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2C4FD8C-A344-B5F4-1AB6-00D900CE7E6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2C4FD8C-A344-B5F4-1AB6-00D900CE7E6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2C4FD8C-A344-B5F4-1AB6-00D900CE7E6C}.Release|Any CPU.Build.0 = Release|Any CPU
{B2C4FD8C-A344-B5F4-1AB6-00D900CE7E6C}.Test|Any CPU.ActiveCfg = Test|Any CPU
{B2C4FD8C-A344-B5F4-1AB6-00D900CE7E6C}.Test|Any CPU.Build.0 = Test|Any CPU
{6636695F-C700-DD8B-DAB3-F07FAB201A72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6636695F-C700-DD8B-DAB3-F07FAB201A72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6636695F-C700-DD8B-DAB3-F07FAB201A72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6636695F-C700-DD8B-DAB3-F07FAB201A72}.Release|Any CPU.Build.0 = Release|Any CPU
{6636695F-C700-DD8B-DAB3-F07FAB201A72}.Test|Any CPU.ActiveCfg = Test|Any CPU
{6636695F-C700-DD8B-DAB3-F07FAB201A72}.Test|Any CPU.Build.0 = Test|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
45 changes: 43 additions & 2 deletions BlazarTech.QueryableValues.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
# Visual Studio Version 18
VisualStudioVersion = 18.1.11304.174 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.EFCore6", "src\QueryableValues.SqlServer.EFCore6\QueryableValues.SqlServer.EFCore6.csproj", "{BD913E54-FD19-468D-A9D3-1E9608F12D46}"
EndProject
Expand All @@ -21,6 +21,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.T
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5A74EE6E-4DBD-4176-A5E0-12C87C813658}"
ProjectSection(SolutionItems) = preProject
.github\workflows\ci-workflow.yml = .github\workflows\ci-workflow.yml
src\SharedProjectProperties.xml = src\SharedProjectProperties.xml
tests\SharedTestProjectProperties.xml = tests\SharedTestProjectProperties.xml
Version.xml = Version.xml
Expand All @@ -36,6 +37,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.E
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueryableValues.SqlServer.Tests.EFCore8", "tests\QueryableValues.SqlServer.Tests.EFCore8\QueryableValues.SqlServer.Tests.EFCore8.csproj", "{9387545B-CABC-4C63-A163-4F64C65A370F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableValues.SqlServer.EFCore9", "src\QueryableValues.SqlServer.EFCore9\QueryableValues.SqlServer.EFCore9.csproj", "{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableValues.SqlServer.EFCore10", "src\QueryableValues.SqlServer.EFCore10\QueryableValues.SqlServer.EFCore10.csproj", "{C15498D8-E387-451A-8C2F-E52F3DDBC48F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableValues.SqlServer.Tests.EFCore9", "tests\QueryableValues.SqlServer.Tests.EFCore9\QueryableValues.SqlServer.Tests.EFCore9.csproj", "{07C70A98-52DF-41E6-90A0-A7DB803228D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueryableValues.SqlServer.Tests.EFCore10", "tests\QueryableValues.SqlServer.Tests.EFCore10\QueryableValues.SqlServer.Tests.EFCore10.csproj", "{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -138,6 +147,38 @@ Global
{9387545B-CABC-4C63-A163-4F64C65A370F}.Test_All|Any CPU.Build.0 = Test_All|Any CPU
{9387545B-CABC-4C63-A163-4F64C65A370F}.Test|Any CPU.ActiveCfg = Test|Any CPU
{9387545B-CABC-4C63-A163-4F64C65A370F}.Test|Any CPU.Build.0 = Test|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Release|Any CPU.Build.0 = Release|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Test_All|Any CPU.ActiveCfg = Debug|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Test_All|Any CPU.Build.0 = Debug|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Test|Any CPU.ActiveCfg = Test|Any CPU
{6FB261E0-4137-44D5-A2E9-E7AFFB16F745}.Test|Any CPU.Build.0 = Test|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Release|Any CPU.Build.0 = Release|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Test_All|Any CPU.ActiveCfg = Debug|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Test_All|Any CPU.Build.0 = Debug|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Test|Any CPU.ActiveCfg = Test|Any CPU
{C15498D8-E387-451A-8C2F-E52F3DDBC48F}.Test|Any CPU.Build.0 = Test|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Release|Any CPU.Build.0 = Release|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Test_All|Any CPU.ActiveCfg = Test_All|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Test_All|Any CPU.Build.0 = Test_All|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Test|Any CPU.ActiveCfg = Test|Any CPU
{07C70A98-52DF-41E6-90A0-A7DB803228D2}.Test|Any CPU.Build.0 = Test|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Release|Any CPU.Build.0 = Release|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Test_All|Any CPU.ActiveCfg = Test_All|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Test_All|Any CPU.Build.0 = Test_All|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Test|Any CPU.ActiveCfg = Test|Any CPU
{D38DC9DE-C57A-46AE-BFE1-B198EF1D5A20}.Test|Any CPU.Build.0 = Test|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
12 changes: 7 additions & 5 deletions Version.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<Project>
<PropertyGroup>
<VersionEFCore3>3.9.3</VersionEFCore3>
<VersionEFCore5>5.9.3</VersionEFCore5>
<VersionEFCore6>6.9.3</VersionEFCore6>
<VersionEFCore7>7.4.3</VersionEFCore7>
<VersionEFCore8>8.1.1</VersionEFCore8>
<VersionEFCore3>3.9.4</VersionEFCore3>
<VersionEFCore5>5.9.4</VersionEFCore5>
<VersionEFCore6>6.9.4</VersionEFCore6>
<VersionEFCore7>7.4.4</VersionEFCore7>
<VersionEFCore8>8.1.2</VersionEFCore8>
<VersionEFCore9>9.0.0</VersionEFCore9>
<VersionEFCore10>10.0.0</VersionEFCore10>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../SharedProjectProperties.xml" />
<Import Project="../../Version.xml" />

<PropertyGroup>
<VersionPrefix>$(VersionEFCore10)</VersionPrefix>
<TargetFramework>net10.0</TargetFramework>
<Configurations>Debug;Release;Test</Configurations>
<DefineConstants>$(DefineConstants);EFCORE;EFCORE8;EFCORE10</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="10.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[10.0,)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../SharedProjectProperties.xml" />
<Import Project="../../Version.xml" />

<PropertyGroup>
<VersionPrefix>$(VersionEFCore9)</VersionPrefix>
<TargetFramework>net8.0</TargetFramework>
<Configurations>Debug;Release;Test</Configurations>
<DefineConstants>$(DefineConstants);EFCORE;EFCORE8;EFCORE9</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="[9.0,)" />
</ItemGroup>
</Project>
17 changes: 16 additions & 1 deletion src/QueryableValues.SqlServer/ModelCustomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Linq;

namespace BlazarTech.QueryableValues
{
Expand Down Expand Up @@ -39,8 +40,22 @@ private static void SetupEntity<TEntity>(ModelBuilder modelBuilder, Action<Entit
// By mapping to a fake view, we stop EF from including these entities during
// SQL generation in migrations and by the Create and Drop apis in DbContext.Database.
entity
.ToView(Guid.NewGuid().ToString())
.ToView(GetViewName(typeof(TEntity)))
.HasKey(i => i.X);

static string GetViewName(Type type)
{
if (type.IsGenericType)
{
var typeName = type.FullName?.Substring(0, type.FullName.IndexOf('`')) ?? FallbackName(type);
var args = string.Join(".", type.GetGenericArguments().Select(t => t.Name));
return $"{typeName}.{args}";
}

return type.FullName ?? FallbackName(type);

static string FallbackName(Type type) => $"BlazarTech.QueryableValues.{type.Name}";
}
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/SharedProjectProperties.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore6" />
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore7" />
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore8" />
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore9" />
<InternalsVisibleTo Include="BlazarTech.QueryableValues.SqlServer.Tests.EFCore10" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../SharedTestProjectProperties.xml" />

<PropertyGroup>
<TargetFrameworks>net10.0</TargetFrameworks>
<AssemblyName>BlazarTech.QueryableValues.SqlServer.Tests.EFCore10</AssemblyName>
<DefineConstants>$(DefineConstants);TESTS;EFCORE8;EFCORE10</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\QueryableValues.SqlServer.EFCore10\QueryableValues.SqlServer.EFCore10.csproj" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../SharedTestProjectProperties.xml" />

<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<AssemblyName>BlazarTech.QueryableValues.SqlServer.Tests.EFCore9</AssemblyName>
<DefineConstants>$(DefineConstants);TESTS;EFCORE8;EFCORE9</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\QueryableValues.SqlServer.EFCore9\QueryableValues.SqlServer.EFCore9.csproj" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ internal static class DatabaseName
public const string Name = "QueryableValuesTestsEFCore7";
#elif EFCORE8
public const string Name = "QueryableValuesTestsEFCore8";
#elif EFCORE9
public const string Name = "QueryableValuesTestsEFCore9";
#elif EFCORE10
public const string Name = "QueryableValuesTestsEFCore10";
#endif
}

Expand Down