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
4 changes: 2 additions & 2 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
runs-on: ubuntu-latest
needs: test
env:
CORE_PROJECT_PATH: "CmdScale.EntityFrameworkCore.TimescaleDB/CmdScale.EntityFrameworkCore.TimescaleDB.csproj"
DESIGN_PROJECT_PATH: "CmdScale.EntityFrameworkCore.TimescaleDB.Design/CmdScale.EntityFrameworkCore.TimescaleDB.Design.csproj"
CORE_PROJECT_PATH: "src/Eftdb/Eftdb.csproj"
DESIGN_PROJECT_PATH: "src/Eftdb.Design/Eftdb.Design.csproj"

steps:
- name: Checkout repository
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

185 changes: 140 additions & 45 deletions CmdScale.EntityFrameworkCore.TimescaleDB.sln

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ Use [Stryker.NET](https://stryker-mutator.io/docs/stryker-net/introduction) to v
dotnet tool install -g dotnet-stryker

# Run from the test directory
cd CmdScale.EntityFrameworkCore.TimescaleDB.Tests
cd tests/Eftdb.Tests
dotnet stryker

# Quick run (test only changed files)
Expand Down
21 changes: 17 additions & 4 deletions Scripts/Publish-Local.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,26 @@ $ErrorActionPreference = 'Stop'
$LocalNuGetRepo = "C:\_DEV\NuGet Packages"
$SolutionRoot = (Get-Item $PSScriptRoot).Parent.FullName

# Map PackageId names to actual project paths
$ProjectPathMap = @{
"CmdScale.EntityFrameworkCore.TimescaleDB" = "src\Eftdb"
"CmdScale.EntityFrameworkCore.TimescaleDB.Design" = "src\Eftdb.Design"
}

try {
# Find the specified project file
$ProjectDirectory = Join-Path $SolutionRoot $ProjectName
# Resolve the project path from the package name
if ($ProjectPathMap.ContainsKey($ProjectName)) {
$RelativePath = $ProjectPathMap[$ProjectName]
} else {
# Fallback: try using the name directly as a path
$RelativePath = $ProjectName
}

$ProjectDirectory = Join-Path $SolutionRoot $RelativePath
if (-not (Test-Path $ProjectDirectory)) {
throw "Project directory not found at '$ProjectDirectory'."
throw "Project directory not found at '$ProjectDirectory'. Valid project names are: $($ProjectPathMap.Keys -join ', ')"
}

$ProjectFile = Get-ChildItem -Path $ProjectDirectory -Filter *.csproj | Select-Object -First 1
if (-not $ProjectFile) {
throw "No .csproj file found in '$ProjectDirectory'."
Expand Down
48 changes: 35 additions & 13 deletions Scripts/Switch-References.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ param (
)

# --- Configuration ---
$CoreLibraryNames = @(
# Package IDs (used for PackageReference lookups)
$CorePackageIds = @(
"CmdScale.EntityFrameworkCore.TimescaleDB",
"CmdScale.EntityFrameworkCore.TimescaleDB.Design"
)

# Map PackageId to actual project file base names (without .csproj)
$PackageToProjectMap = @{
"CmdScale.EntityFrameworkCore.TimescaleDB" = "Eftdb"
"CmdScale.EntityFrameworkCore.TimescaleDB.Design" = "Eftdb.Design"
}

# For backwards compatibility
$CoreLibraryNames = $CorePackageIds

# --- Script Body ---
try {
# Get the script's directory
Expand All @@ -41,44 +51,56 @@ try {
Write-Host "🔍 Finding all projects..."
$AllProjects = Get-ChildItem -Path $SolutionRoot -Recurse -Filter "*.csproj"

# Identify the core libraries
# Identify the core libraries by matching project file names to package IDs
$CoreProjectPaths = @{}
foreach ($project in $AllProjects) {
if ($CoreLibraryNames -contains $project.BaseName) {
$CoreProjectPaths[$project.BaseName] = $project.FullName
foreach ($packageId in $CorePackageIds) {
$expectedBaseName = $PackageToProjectMap[$packageId]
if ($project.BaseName -eq $expectedBaseName) {
$CoreProjectPaths[$packageId] = $project.FullName
break
}
}
}
$CoreProjectPaths.GetEnumerator() | ForEach-Object { Write-Host " - Found core library: $($_.Key)" }
$CoreProjectPaths.GetEnumerator() | ForEach-Object { Write-Host " - Found core library: $($_.Key) -> $($_.Value)" }

if ($CoreProjectPaths.Count -ne $CoreLibraryNames.Count) {
throw "Could not find all core library projects. Please check the names in the script's configuration section."
if ($CoreProjectPaths.Count -ne $CorePackageIds.Count) {
throw "Could not find all core library projects. Expected: $($CorePackageIds -join ', '). Found: $($CoreProjectPaths.Keys -join ', ')"
}

# Build reverse map: project base name -> package ID
$ProjectToPackageMap = @{}
foreach ($entry in $PackageToProjectMap.GetEnumerator()) {
$ProjectToPackageMap[$entry.Value] = $entry.Key
}

# Build hash map
Write-Host "🔎 Analyzing project dependencies..."
$ConsumerProjectMap = @{}
foreach ($project in $AllProjects) {
[xml]$csprojContent = Get-Content $project.FullName -ErrorAction Stop

$foundCoreRefs = [System.Collections.Generic.List[object]]::new()

# Find ProjectReferences
$projectRefNodes = $csprojContent.SelectNodes("//ProjectReference")
if ($projectRefNodes) {
foreach ($refNode in $projectRefNodes) {
$refName = [System.IO.Path]::GetFileNameWithoutExtension(($refNode.Include).Trim())
if ($CoreLibraryNames -contains $refName) {
$foundCoreRefs.Add([PSCustomObject]@{ Name = $refName; Type = "Project" })
$refBaseName = [System.IO.Path]::GetFileNameWithoutExtension(($refNode.Include).Trim())
# Check if this project file maps to one of our core packages
if ($ProjectToPackageMap.ContainsKey($refBaseName)) {
$packageId = $ProjectToPackageMap[$refBaseName]
$foundCoreRefs.Add([PSCustomObject]@{ Name = $packageId; Type = "Project" })
}
}
}

# Find PackageReferences
# Find PackageReferences (these use package IDs directly)
$packageRefNodes = $csprojContent.SelectNodes("//PackageReference")
if ($packageRefNodes) {
foreach ($refNode in $packageRefNodes) {
$refName = ($refNode.Include).Trim()
if ($CoreLibraryNames -contains $refName) {
if ($CorePackageIds -contains $refName) {
$foundCoreRefs.Add([PSCustomObject]@{ Name = $refName; Type = "Package" })
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.Benchmarks</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.Benchmarks</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess\CmdScale.EntityFrameworkCore.TimescaleDB.Example.DataAccess.csproj" />
<ProjectReference Include="..\..\samples\Eftdb.Samples.Shared\Eftdb.Samples.Shared.csproj" />
</ItemGroup>

</Project>
28 changes: 28 additions & 0 deletions samples/Eftdb.Samples.CodeFirst/Eftdb.Samples.CodeFirst.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.Samples.CodeFirst</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.Samples.CodeFirst</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EFCore.NamingConventions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Eftdb.Samples.Shared\Eftdb.Samples.Shared.csproj" />
<ProjectReference Include="..\..\src\Eftdb.Design\Eftdb.Design.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.Samples.DatabaseFirst</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.Samples.DatabaseFirst</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Eftdb.Design\Eftdb.Design.csproj" />
</ItemGroup>

</Project>
15 changes: 15 additions & 0 deletions samples/Eftdb.Samples.Shared/Eftdb.Samples.Shared.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.Samples.Shared</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.Samples.Shared</RootNamespace>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Eftdb\Eftdb.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.Design</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.Design</RootNamespace>
<PackageId>CmdScale.EntityFrameworkCore.TimescaleDB.Design</PackageId>
<Version>0.3.1</Version>
<Authors>CmdScale</Authors>
Expand All @@ -25,22 +27,22 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8" />
</ItemGroup>
<ItemGroup>
<None Include="..\assets\cmd-nuget-logo.jpg">
<None Include="..\..\assets\cmd-nuget-logo.jpg">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\LICENSE">
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\README.md">
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<Content Include="build\**\*" Pack="true" PackagePath="build\" />
<Content Include="build\**\*" Pack="true" PackagePath="buildTransitive\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CmdScale.EntityFrameworkCore.TimescaleDB\CmdScale.EntityFrameworkCore.TimescaleDB.csproj" />
<ProjectReference Include="..\Eftdb\Eftdb.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB</RootNamespace>
<PackageId>CmdScale.EntityFrameworkCore.TimescaleDB</PackageId>
<Version>0.3.1</Version>
<Authors>CmdScale</Authors>
Expand All @@ -22,15 +24,15 @@
<PackageTags>timescaledb;timescale;efcore;ef-core;entityframeworkcore;postgresql;postgres;time-series;timeseries;data;database;efcore-provider;</PackageTags>
</PropertyGroup>
<ItemGroup>
<None Include="..\assets\cmd-nuget-logo.jpg">
<None Include="..\..\assets\cmd-nuget-logo.jpg">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\LICENSE">
<None Include="..\..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\README.md">
<None Include="..\..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.FunctionalTests</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.FunctionalTests</RootNamespace>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand All @@ -29,8 +31,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CmdScale.EntityFrameworkCore.TimescaleDB.Design\CmdScale.EntityFrameworkCore.TimescaleDB.Design.csproj" />
<ProjectReference Include="..\CmdScale.EntityFrameworkCore.TimescaleDB\CmdScale.EntityFrameworkCore.TimescaleDB.csproj" />
<ProjectReference Include="..\..\src\Eftdb.Design\Eftdb.Design.csproj" />
<ProjectReference Include="..\..\src\Eftdb\Eftdb.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>CmdScale.EntityFrameworkCore.TimescaleDB.Tests</AssemblyName>
<RootNamespace>CmdScale.EntityFrameworkCore.TimescaleDB.Tests</RootNamespace>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand All @@ -30,8 +32,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CmdScale.EntityFrameworkCore.TimescaleDB\CmdScale.EntityFrameworkCore.TimescaleDB.csproj" />
<ProjectReference Include="..\CmdScale.EntityFrameworkCore.TimescaleDB.Design\CmdScale.EntityFrameworkCore.TimescaleDB.Design.csproj" />
<ProjectReference Include="..\..\src\Eftdb\Eftdb.csproj" />
<ProjectReference Include="..\..\src\Eftdb.Design\Eftdb.Design.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dotnet tool install -g dotnet-stryker

### 2. Run Mutation Testing

From the `CmdScale.EntityFrameworkCore.TimescaleDB.Tests` directory:
From the `tests/Eftdb.Tests` directory:

```bash
# Full mutation run (can take 30-60 minutes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "CmdScale.EntityFrameworkCore.TimescaleDB.Tests",
"version": "0.3.0"
},
"solution": "../CmdScale.EntityFrameworkCore.TimescaleDB.sln",
"solution": "../../CmdScale.EntityFrameworkCore.TimescaleDB.sln",
"project": "CmdScale.EntityFrameworkCore.TimescaleDB.csproj",
"test-projects": [
"CmdScale.EntityFrameworkCore.TimescaleDB.Tests.csproj"
Expand Down
Loading