Skip to content

Commit b1f4321

Browse files
Merge pull request #17 from anton-schieber/feature/project-structure
treewide: update project structure
2 parents a7196e5 + 7716f81 commit b1f4321

File tree

149 files changed

+277
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+277
-130
lines changed

.github/workflows/publish-nuget.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
runs-on: ubuntu-latest
3838
needs: test
3939
env:
40-
CORE_PROJECT_PATH: "CmdScale.EntityFrameworkCore.TimescaleDB/CmdScale.EntityFrameworkCore.TimescaleDB.csproj"
41-
DESIGN_PROJECT_PATH: "CmdScale.EntityFrameworkCore.TimescaleDB.Design/CmdScale.EntityFrameworkCore.TimescaleDB.Design.csproj"
40+
CORE_PROJECT_PATH: "src/Eftdb/Eftdb.csproj"
41+
DESIGN_PROJECT_PATH: "src/Eftdb.Design/Eftdb.Design.csproj"
4242

4343
steps:
4444
- name: Checkout repository

CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess.DbFirst/CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess.DbFirst.csproj

Lines changed: 0 additions & 13 deletions
This file was deleted.

CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess/CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess.csproj

Lines changed: 0 additions & 13 deletions
This file was deleted.

CmdScale.EntityFrameworkCore.TimescaleDB.Example/CmdScale.EntityFrameworkCore.TimescaleDB.Example.csproj

Lines changed: 0 additions & 25 deletions
This file was deleted.

CmdScale.EntityFrameworkCore.TimescaleDB.sln

Lines changed: 140 additions & 45 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 1 deletion

Scripts/Publish-Local.ps1

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,26 @@ $ErrorActionPreference = 'Stop'
1818
$LocalNuGetRepo = "C:\_DEV\NuGet Packages"
1919
$SolutionRoot = (Get-Item $PSScriptRoot).Parent.FullName
2020

21+
# Map PackageId names to actual project paths
22+
$ProjectPathMap = @{
23+
"CmdScale.EntityFrameworkCore.TimescaleDB" = "src\Eftdb"
24+
"CmdScale.EntityFrameworkCore.TimescaleDB.Design" = "src\Eftdb.Design"
25+
}
26+
2127
try {
22-
# Find the specified project file
23-
$ProjectDirectory = Join-Path $SolutionRoot $ProjectName
28+
# Resolve the project path from the package name
29+
if ($ProjectPathMap.ContainsKey($ProjectName)) {
30+
$RelativePath = $ProjectPathMap[$ProjectName]
31+
} else {
32+
# Fallback: try using the name directly as a path
33+
$RelativePath = $ProjectName
34+
}
35+
36+
$ProjectDirectory = Join-Path $SolutionRoot $RelativePath
2437
if (-not (Test-Path $ProjectDirectory)) {
25-
throw "Project directory not found at '$ProjectDirectory'."
38+
throw "Project directory not found at '$ProjectDirectory'. Valid project names are: $($ProjectPathMap.Keys -join ', ')"
2639
}
27-
40+
2841
$ProjectFile = Get-ChildItem -Path $ProjectDirectory -Filter *.csproj | Select-Object -First 1
2942
if (-not $ProjectFile) {
3043
throw "No .csproj file found in '$ProjectDirectory'."

Scripts/Switch-References.ps1

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,21 @@ param (
2626
)
2727

2828
# --- Configuration ---
29-
$CoreLibraryNames = @(
29+
# Package IDs (used for PackageReference lookups)
30+
$CorePackageIds = @(
3031
"CmdScale.EntityFrameworkCore.TimescaleDB",
3132
"CmdScale.EntityFrameworkCore.TimescaleDB.Design"
3233
)
3334

35+
# Map PackageId to actual project file base names (without .csproj)
36+
$PackageToProjectMap = @{
37+
"CmdScale.EntityFrameworkCore.TimescaleDB" = "Eftdb"
38+
"CmdScale.EntityFrameworkCore.TimescaleDB.Design" = "Eftdb.Design"
39+
}
40+
41+
# For backwards compatibility
42+
$CoreLibraryNames = $CorePackageIds
43+
3444
# --- Script Body ---
3545
try {
3646
# Get the script's directory
@@ -41,44 +51,56 @@ try {
4151
Write-Host "🔍 Finding all projects..."
4252
$AllProjects = Get-ChildItem -Path $SolutionRoot -Recurse -Filter "*.csproj"
4353

44-
# Identify the core libraries
54+
# Identify the core libraries by matching project file names to package IDs
4555
$CoreProjectPaths = @{}
4656
foreach ($project in $AllProjects) {
47-
if ($CoreLibraryNames -contains $project.BaseName) {
48-
$CoreProjectPaths[$project.BaseName] = $project.FullName
57+
foreach ($packageId in $CorePackageIds) {
58+
$expectedBaseName = $PackageToProjectMap[$packageId]
59+
if ($project.BaseName -eq $expectedBaseName) {
60+
$CoreProjectPaths[$packageId] = $project.FullName
61+
break
62+
}
4963
}
5064
}
51-
$CoreProjectPaths.GetEnumerator() | ForEach-Object { Write-Host " - Found core library: $($_.Key)" }
65+
$CoreProjectPaths.GetEnumerator() | ForEach-Object { Write-Host " - Found core library: $($_.Key) -> $($_.Value)" }
5266

53-
if ($CoreProjectPaths.Count -ne $CoreLibraryNames.Count) {
54-
throw "Could not find all core library projects. Please check the names in the script's configuration section."
67+
if ($CoreProjectPaths.Count -ne $CorePackageIds.Count) {
68+
throw "Could not find all core library projects. Expected: $($CorePackageIds -join ', '). Found: $($CoreProjectPaths.Keys -join ', ')"
69+
}
70+
71+
# Build reverse map: project base name -> package ID
72+
$ProjectToPackageMap = @{}
73+
foreach ($entry in $PackageToProjectMap.GetEnumerator()) {
74+
$ProjectToPackageMap[$entry.Value] = $entry.Key
5575
}
5676

5777
# Build hash map
5878
Write-Host "🔎 Analyzing project dependencies..."
5979
$ConsumerProjectMap = @{}
6080
foreach ($project in $AllProjects) {
6181
[xml]$csprojContent = Get-Content $project.FullName -ErrorAction Stop
62-
82+
6383
$foundCoreRefs = [System.Collections.Generic.List[object]]::new()
6484

6585
# Find ProjectReferences
6686
$projectRefNodes = $csprojContent.SelectNodes("//ProjectReference")
6787
if ($projectRefNodes) {
6888
foreach ($refNode in $projectRefNodes) {
69-
$refName = [System.IO.Path]::GetFileNameWithoutExtension(($refNode.Include).Trim())
70-
if ($CoreLibraryNames -contains $refName) {
71-
$foundCoreRefs.Add([PSCustomObject]@{ Name = $refName; Type = "Project" })
89+
$refBaseName = [System.IO.Path]::GetFileNameWithoutExtension(($refNode.Include).Trim())
90+
# Check if this project file maps to one of our core packages
91+
if ($ProjectToPackageMap.ContainsKey($refBaseName)) {
92+
$packageId = $ProjectToPackageMap[$refBaseName]
93+
$foundCoreRefs.Add([PSCustomObject]@{ Name = $packageId; Type = "Project" })
7294
}
7395
}
7496
}
7597

76-
# Find PackageReferences
98+
# Find PackageReferences (these use package IDs directly)
7799
$packageRefNodes = $csprojContent.SelectNodes("//PackageReference")
78100
if ($packageRefNodes) {
79101
foreach ($refNode in $packageRefNodes) {
80102
$refName = ($refNode.Include).Trim()
81-
if ($CoreLibraryNames -contains $refName) {
103+
if ($CorePackageIds -contains $refName) {
82104
$foundCoreRefs.Add([PSCustomObject]@{ Name = $refName; Type = "Package" })
83105
}
84106
}

CmdScale.EntityFrameworkCore.TimescaleDB.Benchmarks/CmdScale.EntityFrameworkCore.TimescaleDB.Benchmarks.csproj renamed to benchmarks/Eftdb.Benchmarks/Eftdb.Benchmarks.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8+
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.Benchmarks</AssemblyName>
9+
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.Benchmarks</RootNamespace>
810
</PropertyGroup>
911

1012
<ItemGroup>
@@ -18,7 +20,7 @@
1820
</ItemGroup>
1921

2022
<ItemGroup>
21-
<ProjectReference Include="..\CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess\CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess.csproj" />
23+
<ProjectReference Include="..\..\samples\Eftdb.Samples.Shared\Eftdb.Samples.Shared.csproj" />
2224
</ItemGroup>
2325

2426
</Project>

CmdScale.EntityFrameworkCore.TimescaleDB.Benchmarks/InProcessConfig.cs renamed to benchmarks/Eftdb.Benchmarks/InProcessConfig.cs

File renamed without changes.

0 commit comments

Comments
 (0)