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/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ updates:
schedule:
interval: "weekly"
- package-ecosystem: nuget
directory: "/src/ByteAether.Ulid"
directory: "/src/Ulid"
schedule:
interval: "weekly"
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test-aot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:
dotnet-version: '10.0.x'

- name: Restore dependencies
run: dotnet restore src/ByteAether.Ulid.sln --use-current-runtime -p:SelfContained=true
run: dotnet restore src/ByteAether.Ulid.slnx -p:Configuration=CI-Release --use-current-runtime -p:SelfContained=true

- name: Build and Publish AOT Console Application (${{ matrix.os }})
run: dotnet publish src/ByteAether.Ulid.Tests.AotConsole/ByteAether.Ulid.Tests.AotConsole.csproj --no-restore -c Release --use-current-runtime --self-contained true -o ./publish
run: dotnet publish src/Ulid.Tests.AotConsole/Tests.AotConsole.csproj --configuration CI-Release --no-restore --use-current-runtime --self-contained true -o ./publish

- name: Run AOT Compiled Application (${{ matrix.os }})
shell: bash # Ensure bash is used on Windows as well for consistent pathing syntax (./)
run: ./publish/ByteAether.Ulid.Tests.AotConsole
run: ./publish/Tests.AotConsole
12 changes: 7 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,22 @@ jobs:
5.x

- name: Restore dependencies
run: dotnet restore src/ByteAether.Ulid.sln
run: dotnet restore src/ByteAether.Ulid.slnx -p:Configuration=CI-Release

- name: Build
run: dotnet build --no-restore --configuration Release src/ByteAether.Ulid.sln
run: dotnet build src/ByteAether.Ulid.slnx --configuration CI-Release --no-restore

- name: Upload DLLs
uses: actions/upload-artifact@v7
with:
name: dlls-${{ steps.vars.outputs.sha_short }}
path: ./**/ByteAether.Ulid/bin/**/*.dll
path: |
./**/Ulid/bin/**/*.dll
./**/EFCore.Impl/bin/**/*.dll

- name: Run tests
continue-on-error: true
run: dotnet test --no-build --verbosity normal --logger "trx" --configuration Release src/ByteAether.Ulid.sln
run: dotnet test src/ByteAether.Ulid.slnx --configuration CI-Release --no-build --verbosity normal --logger "trx"

- name: Upload test results
uses: actions/upload-artifact@v7
Expand All @@ -59,7 +61,7 @@ jobs:
path: ./**/TestResults/**/*.trx

- name: Pack
run: dotnet pack --configuration Release /p:ContinuousIntegrationBuild=true /p:PackageVersion=0.0.0-ci-${{ steps.vars.outputs.sha_short }} /p:PackageReleaseNotes="CI Build ${{ steps.vars.outputs.sha_short }}" --output ./output src/ByteAether.Ulid/ByteAether.Ulid.csproj
run: dotnet pack src/ByteAether.Ulid.slnx --configuration CI-Release -p:ContinuousIntegrationBuild=true -p:PackageVersion=0.0.0-ci-${{ steps.vars.outputs.sha_short }} -p:PackageReleaseNotes="CI Build ${{ steps.vars.outputs.sha_short }}" --output ./output

- name: Upload NuGet package
uses: actions/upload-artifact@v7
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ jobs:
- name: Build the code
run: |
# Restore dependencies and build the C# project
dotnet restore src/ByteAether.Ulid/ByteAether.Ulid.csproj
dotnet build --no-incremental --configuration Release src/ByteAether.Ulid/ByteAether.Ulid.csproj
dotnet restore src/Ulid/Impl.csproj -p:Configuration=CI-Release
dotnet restore src/EFCore/EFCore.Impl.csproj -p:Configuration=CI-Release
dotnet build src/Ulid/Impl.csproj --configuration CI-Release --no-incremental
dotnet build src/EFCore/EFCore.Impl.csproj --configuration CI-Release --no-incremental

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: echo "version-without-v=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"

- name: Pack
run: dotnet pack --configuration Release /p:ContinuousIntegrationBuild=true /p:PackageVersion=${{ steps.version.outputs.version-without-v }} --output ./output src/ByteAether.Ulid/ByteAether.Ulid.csproj
run: dotnet pack src/ByteAether.Ulid.slnx --configuration CI-Release -p:ContinuousIntegrationBuild=true -p:PackageVersion=${{ steps.version.outputs.version-without-v }} --output ./output

- name: Upload NuGet package as artifact
uses: actions/upload-artifact@v7
Expand Down
213 changes: 124 additions & 89 deletions README.md

Large diffs are not rendered by default.

50 changes: 0 additions & 50 deletions src/ByteAether.Ulid.sln

This file was deleted.

28 changes: 28 additions & 0 deletions src/ByteAether.Ulid.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<Solution>
<Configurations>
<BuildType Name="Debug" />
<BuildType Name="Release" />
<BuildType Name="CI-Debug" />
<BuildType Name="CI-Release" />
</Configurations>
<Folder Name="/EFCore/">
<Project Path="EFCore.IntegrationTests/EFCore.IntegrationTests.csproj" />
<Project Path="EFCore.Tests/EFCore.Tests.csproj" />
<Project Path="EFCore/EFCore.Impl.csproj" />
</Folder>
<Folder Name="/Solution Items/">
<File Path="../README.md" />
<File Path=".editorconfig" />
<File Path=".runsettings" />
<File Path="Directory.Build.props" />
</Folder>
<Folder Name="/Ulid/">
<Project Path="Ulid.Benchmarks/Benchmarks.csproj">
<Build Solution="CI-Debug|*" Project="false" />
<Build Solution="CI-Release|*" Project="false" />
</Project>
<Project Path="Ulid.Tests.AotConsole/Tests.AotConsole.csproj" />
<Project Path="Ulid.Tests/Tests.csproj" />
<Project Path="Ulid/Impl.csproj" />
</Folder>
</Solution>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

// https://github.com/dotnet/runtime/blob/8d796d8e60a5236cbd5f113ead1d3831064cdba1/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/MemoryMarshal.cs#L226

namespace ByteAether.Ulid.Compatibility;
namespace Compatibility;

public static class MemoryMarshal
internal static class MemoryMarshal
{
/// <summary>
/// Creates a new span over a portion of a regular managed object. This can be useful
Expand Down
File renamed without changes.
50 changes: 50 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>

<!-- NuGet Packaging -->
<IsPackable>false</IsPackable>
<Deterministic>true</Deterministic>
<InvariantGlobalization>true</InvariantGlobalization>

<GenerateDocumentationFile>false</GenerateDocumentationFile>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<Authors>Joonatan Uusväli</Authors>
<Company>ByteAether</Company>
<Copyright>© $(Authors), $(Company). All rights reserved.</Copyright>

<RepositoryUrl>https://github.com/ByteAether/Ulid</RepositoryUrl>
<RepositoryType>git</RepositoryType>

<PackageProjectUrl>$(RepositoryUrl)/tree/v$(PackageVersion)</PackageProjectUrl>
<PackageReleaseNotes>See $(RepositoryUrl)/releases/tag/v$(PackageVersion)</PackageReleaseNotes>

<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'CI-Release'"><Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>

<PublishRelease>true</PublishRelease>
<PackRelease>true</PackRelease>

<RuntimeIdentifierGraphPath Condition="'$(RuntimeIdentifierGraphPath)' == ''"></RuntimeIdentifierGraphPath>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'CI-Debug'">
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\assets\logo.png" Pack="true" PackagePath="\" Visible="false" />
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\LICENSE" />
</ItemGroup>
</Project>
36 changes: 36 additions & 0 deletions src/EFCore.IntegrationTests/EFCore.IntegrationTests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net10.0;net9.0;net8.0;net7.0;net6.0</TargetFrameworks>
<NoWarn>NU1903</NoWarn>

<RootNamespace>ByteAether.Ulid.EntityFrameworkCore.IntegrationTests</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" Condition="'$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net7.0'"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" Condition="'$(TargetFramework)' != 'net6.0' And '$(TargetFramework)' != 'net7.0'"/>

<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" Condition="'$(TargetFramework)' == 'net6.0' Or '$(TargetFramework)' == 'net7.0'">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" Condition="'$(TargetFramework)' != 'net6.0' And '$(TargetFramework)' != 'net7.0'">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<PackageReference Include="xunit" Version="2.9.3" />

<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.36" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.20" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.28" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.17" Condition="'$(TargetFramework)' == 'net9.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.9" Condition="'$(TargetFramework)' == 'net10.0'" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\EFCore\EFCore.Impl.csproj" />
</ItemGroup>

</Project>
54 changes: 54 additions & 0 deletions src/EFCore.IntegrationTests/TestDbContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace ByteAether.Ulid.EntityFrameworkCore.IntegrationTests;

public class TestEntity
{
public int Id { get; set; }
public Ulid SystemUlid { get; set; }
public Ulid? NullableUlid { get; set; }
}

public class RelatedChildEntity
{
public int Id { get; set; }
public Ulid ParentSystemUlid { get; set; } // Foreign Key mapped to the ULID
public string Description { get; set; } = string.Empty;
}

public class TestDbContext(DbContextOptions<TestDbContext> Options, UlidStorageFormat StorageFormat) : DbContext(Options)
{
public UlidStorageFormat StorageFormat { get; } = StorageFormat;

public DbSet<TestEntity> TestEntities => Set<TestEntity>();
public DbSet<RelatedChildEntity> RelatedChildren => Set<RelatedChildEntity>();

protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
// Execute the single-line convention extension being tested
configurationBuilder.RegisterUlid(StorageFormat);
}

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
base.OnConfiguring(optionsBuilder);

// Replace the default model caching behavior with our custom parameterized factory
optionsBuilder.ReplaceService<IModelCacheKeyFactory, TestDbContextCacheKeyFactory>();
}

public class TestDbContextCacheKeyFactory : IModelCacheKeyFactory
{
public object Create(DbContext context, bool designTime)
{
// If it's our test context, include the storage format in the cache signature
if (context is TestDbContext testContext)
{
return (context.GetType(), testContext.StorageFormat, designTime);
}

return (context.GetType(), designTime);
}
}
}
Loading
Loading