Skip to content

Commit 245dffb

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 8a3059b + b5426d4 commit 245dffb

21 files changed

Lines changed: 401 additions & 109 deletions

.github/workflows/publish-to-nuget.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ jobs:
1616
with:
1717
dotnet-version: '9.0.x'
1818

19-
# verify installed SDKs
20-
- name: Show installed .NET SDKs
21-
run: dotnet --list-sdks
22-
2319

2420
- name: Restore EFCore dependencies
2521
run: dotnet restore src/EFCore/EFCore.csproj
@@ -28,16 +24,15 @@ jobs:
2824
run: dotnet restore src/EfCoreSqlClr/EfCoreSqlClr.csproj
2925

3026
- name: Build EfCoreSqlClr (net48)
31-
run: dotnet build src/EfCoreSqlClr/EfCoreSqlClr.csproj --configuration Release --no-restore
27+
run: dotnet build src/EfCoreSqlClr/EfCoreSqlClr.csproj --configuration Release
3228

3329
- name: Build EFCore (net9.0) with SQL CLR included
34-
run: dotnet build src/EFCore/EFCore.csproj --configuration Release --no-restore
30+
run: dotnet build src/EFCore/EFCore.csproj --configuration Release
3531

3632
- name: Pack EFCore (embed EfCoreSqlClr.dll)
3733
run: |
3834
dotnet pack src/EFCore/EFCore.csproj `
3935
--configuration Release `
40-
--no-build `
4136
--output ${{ github.workspace }}/artifacts `
4237
-p:SuppressDependenciesWhenPacking=true
4338

Directory.Packages.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.6" />
7+
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.0.6" />
78
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.6" />
89
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
910
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.11.0" />
@@ -34,6 +35,7 @@
3435
<PackageVersion Include="FluentAssertions" Version="8.3.0" />
3536
<PackageVersion Include="Verify.Xunit" Version="30.3.1" />
3637
<PackageVersion Include="NSubstitute" Version="5.3.0" />
38+
<PackageVersion Include="Docker.DotNet" Version="3.128.0" />
3739
</ItemGroup>
3840
<ItemGroup Label="Code Analyzers PackageVersions">
3941
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0" />

EasyPersistence.sln

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36109.1 d17.14
5+
MinimumVisualStudioVersion = 10.0.40219.1
36
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{84933542-7AEA-4055-AB08-6E22DF68EB59}"
47
EndProject
58
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{FDE29923-9F23-44A0-B637-B5C921D58104}"
@@ -9,13 +12,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
912
.editorconfig = .editorconfig
1013
.gitattributes = .gitattributes
1114
.gitignore = .gitignore
15+
.github\COPILOT.md = .github\COPILOT.md
1216
Directory.Build.props = Directory.Build.props
1317
Directory.Packages.props = Directory.Packages.props
14-
nuget.config = nuget.config
1518
global.json = global.json
16-
.github\COPILOT.md = .github\COPILOT.md
17-
README.md = README.md
1819
LICENSE.txt = LICENSE.txt
20+
nuget.config = nuget.config
21+
README.md = README.md
1922
EndProjectSection
2023
EndProject
2124
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{9A93824F-1E1C-435A-A424-13CD43614A0A}"
@@ -39,10 +42,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHubWorkflows", "GitHubWo
3942
EndProject
4043
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{4BE8F2F3-2D6E-4660-A137-D4F9A177F66E}"
4144
ProjectSection(SolutionItems) = preProject
42-
Docs\Useing-Domain-Events.md = Docs\Useing-Domain-Events.md
4345
Docs\Index.md = Docs\Index.md
46+
Docs\Useing-Domain-Events.md = Docs\Useing-Domain-Events.md
4447
EndProjectSection
4548
EndProject
49+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EFCoreTestApp", "examples\EFCoreTestApp\EFCoreTestApp.csproj", "{6045C80A-CFF6-46D8-A0A5-045F5ED8862A}"
50+
EndProject
4651
Global
4752
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4853
Debug|Any CPU = Debug|Any CPU
@@ -73,6 +78,13 @@ Global
7378
{C4D5D320-163A-40D4-B53D-D8BFBB74D500}.Debug|Any CPU.Build.0 = Debug|Any CPU
7479
{C4D5D320-163A-40D4-B53D-D8BFBB74D500}.Release|Any CPU.ActiveCfg = Release|Any CPU
7580
{C4D5D320-163A-40D4-B53D-D8BFBB74D500}.Release|Any CPU.Build.0 = Release|Any CPU
81+
{6045C80A-CFF6-46D8-A0A5-045F5ED8862A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
82+
{6045C80A-CFF6-46D8-A0A5-045F5ED8862A}.Debug|Any CPU.Build.0 = Debug|Any CPU
83+
{6045C80A-CFF6-46D8-A0A5-045F5ED8862A}.Release|Any CPU.ActiveCfg = Release|Any CPU
84+
{6045C80A-CFF6-46D8-A0A5-045F5ED8862A}.Release|Any CPU.Build.0 = Release|Any CPU
85+
EndGlobalSection
86+
GlobalSection(SolutionProperties) = preSolution
87+
HideSolutionNode = FALSE
7688
EndGlobalSection
7789
GlobalSection(NestedProjects) = preSolution
7890
{2DF2B027-3F72-418F-A398-2955FE82C78E} = {84933542-7AEA-4055-AB08-6E22DF68EB59}
@@ -82,5 +94,9 @@ Global
8294
{4FDD45B2-E2BD-43FA-A3F3-D7CC6F1057E9} = {84933542-7AEA-4055-AB08-6E22DF68EB59}
8395
{C4D5D320-163A-40D4-B53D-D8BFBB74D500} = {FDE29923-9F23-44A0-B637-B5C921D58104}
8496
{18B68165-A6AF-4E33-BCA3-374326189687} = {4A7F29E1-24AD-4B6C-BBC8-7DACAE19EECB}
97+
{6045C80A-CFF6-46D8-A0A5-045F5ED8862A} = {9A93824F-1E1C-435A-A424-13CD43614A0A}
98+
EndGlobalSection
99+
GlobalSection(ExtensibilityGlobals) = postSolution
100+
SolutionGuid = {71E74C7C-0620-4681-B0F8-B555774E8F2B}
85101
EndGlobalSection
86102
EndGlobal
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Microsoft.EntityFrameworkCore;
2+
using ZeidLab.ToolBox.EasyPersistence.EFCore;
3+
namespace ZeidLab.ToolBox.EasyPersistence.EFCoreTestApp.Data
4+
{
5+
public class TodoList : EntityBase<int> , IAggregateRoot
6+
{
7+
public string? Title { get; set; }
8+
}
9+
10+
public class AppDbContext : DbContext
11+
{
12+
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
13+
14+
public DbSet<TodoList> TodoLists { get; set; }
15+
16+
protected override void OnModelCreating(ModelBuilder modelBuilder)
17+
{
18+
base.OnModelCreating(modelBuilder);
19+
modelBuilder.RegisterFuzzySearchMethods();
20+
}
21+
}
22+
}
23+

examples/EFCoreTestApp/Data/Migrations/20250629112640_Initial.Designer.cs

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace ZeidLab.ToolBox.EasyPersistence.EFCoreTestApp.Data.Migrations
6+
{
7+
/// <inheritdoc />
8+
public partial class Initial : Migration
9+
{
10+
/// <inheritdoc />
11+
protected override void Up(MigrationBuilder migrationBuilder)
12+
{
13+
migrationBuilder.CreateTable(
14+
name: "TodoLists",
15+
columns: table => new
16+
{
17+
Id = table.Column<int>(type: "int", nullable: false)
18+
.Annotation("SqlServer:Identity", "1, 1"),
19+
Title = table.Column<string>(type: "nvarchar(max)", nullable: true)
20+
},
21+
constraints: table =>
22+
{
23+
table.PrimaryKey("PK_TodoLists", x => x.Id);
24+
});
25+
}
26+
27+
/// <inheritdoc />
28+
protected override void Down(MigrationBuilder migrationBuilder)
29+
{
30+
migrationBuilder.DropTable(
31+
name: "TodoLists");
32+
}
33+
}
34+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// <auto-generated />
2+
using Microsoft.EntityFrameworkCore;
3+
using Microsoft.EntityFrameworkCore.Infrastructure;
4+
using Microsoft.EntityFrameworkCore.Metadata;
5+
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
6+
using ZeidLab.ToolBox.EasyPersistence.EFCoreTestApp.Data;
7+
8+
#nullable disable
9+
10+
namespace ZeidLab.ToolBox.EasyPersistence.EFCoreTestApp.Data.Migrations
11+
{
12+
[DbContext(typeof(AppDbContext))]
13+
partial class AppDbContextModelSnapshot : ModelSnapshot
14+
{
15+
protected override void BuildModel(ModelBuilder modelBuilder)
16+
{
17+
#pragma warning disable 612, 618
18+
modelBuilder
19+
.HasAnnotation("ProductVersion", "9.0.6")
20+
.HasAnnotation("Relational:MaxIdentifierLength", 128);
21+
22+
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
23+
24+
modelBuilder.Entity("ZeidLab.ToolBox.EasyPersistence.EFCoreTestApp.Data.TodoList", b =>
25+
{
26+
b.Property<int>("Id")
27+
.ValueGeneratedOnAdd()
28+
.HasColumnType("int");
29+
30+
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
31+
32+
b.Property<string>("Title")
33+
.HasColumnType("nvarchar(max)");
34+
35+
b.HasKey("Id");
36+
37+
b.ToTable("TodoLists");
38+
});
39+
#pragma warning restore 612, 618
40+
}
41+
}
42+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
11+
<PackageReference Include="Microsoft.EntityFrameworkCore" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\..\src\EFCoreSqlClr\EFCoreSqlClr.csproj" />
18+
<ProjectReference Include="..\..\src\EFCore\EFCore.csproj" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<Folder Include="Data\Migrations\" />
23+
</ItemGroup>
24+
25+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@EFCoreTestApp_HostAddress = http://localhost:5024
2+
3+
GET {{EFCoreTestApp_HostAddress}}/weatherforecast/
4+
Accept: application/json
5+
6+
###

examples/EFCoreTestApp/Program.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using Microsoft.EntityFrameworkCore;
2+
3+
using ZeidLab.ToolBox.EasyPersistence.EFCoreTestApp;
4+
using ZeidLab.ToolBox.EasyPersistence.EFCoreTestApp.Data;
5+
6+
var builder = WebApplication.CreateBuilder(args);
7+
8+
// Add services to the container.
9+
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
10+
builder.Services.AddOpenApi();
11+
builder.Services.AddDbContext<AppDbContext>(options =>
12+
{
13+
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
14+
options.UseSqlServer(connectionString);
15+
options.EnableSensitiveDataLogging();
16+
});
17+
18+
19+
var app = builder.Build();
20+
21+
await app.RegisterFuzzySearchAssemblyAsync<AppDbContext>();
22+
23+
// Configure the HTTP request pipeline.
24+
if (app.Environment.IsDevelopment())
25+
{
26+
app.MapOpenApi();
27+
}
28+
29+
app.UseHttpsRedirection();
30+
31+
var summaries = new[]
32+
{
33+
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
34+
};
35+
36+
app.MapGet("/weatherforecast", () =>
37+
{
38+
var forecast = Enumerable.Range(1, 5).Select(index =>
39+
new WeatherForecast
40+
(
41+
DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
42+
Random.Shared.Next(-20, 55),
43+
summaries[Random.Shared.Next(summaries.Length)]
44+
))
45+
.ToArray();
46+
return forecast;
47+
})
48+
.WithName("GetWeatherForecast");
49+
50+
app.Run();
51+
52+
internal record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
53+
{
54+
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
55+
}

0 commit comments

Comments
 (0)