diff --git a/Code/.editorconfig b/.editorconfig
similarity index 100%
rename from Code/.editorconfig
rename to .editorconfig
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 8ff18f2..0444cc3 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -20,8 +20,8 @@ jobs:
with:
dotnet-version: 9.0.x
- name: Restore dependencies
- run: dotnet restore ./Code/Light.SharedCore.slnx
+ run: dotnet restore ./Light.SharedCore.slnx
- name: Build
- run: dotnet build ./Code/Light.SharedCore.slnx -c Release --no-restore
+ run: dotnet build ./Light.SharedCore.slnx -c Release --no-restore
- name: Test
- run: dotnet test ./Code/Light.SharedCore.Tests/Light.SharedCore.Tests.csproj -c Release --no-build --verbosity normal
+ run: dotnet test ./Light.SharedCore.Tests/Light.SharedCore.Tests.csproj -c Release --no-build --verbosity normal
diff --git a/.github/workflows/release-on-nuget.yml b/.github/workflows/release-on-nuget.yml
index 01ba207..499a7f9 100644
--- a/.github/workflows/release-on-nuget.yml
+++ b/.github/workflows/release-on-nuget.yml
@@ -25,12 +25,12 @@ jobs:
env:
LIGHT_SHAREDCORE_SNK: ${{ secrets.LIGHT_SHAREDCORE_SNK }}
run: |
- echo $LIGHT_SHAREDCORE_SNK | base64 --decode > ./Code/Light.SharedCore/Light.SharedCore.snk
+ echo $LIGHT_SHAREDCORE_SNK | base64 --decode > ./Light.SharedCore/Light.SharedCore.snk
- name: Create NuGet packages
- run: dotnet pack ./Code/Light.SharedCore/Light.SharedCore.csproj -c Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=Light.SharedCore.snk /p:ContinuousIntegrationBuild=true
+ run: dotnet pack ./Light.SharedCore/Light.SharedCore.csproj -c Release /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=Light.SharedCore.snk /p:ContinuousIntegrationBuild=true
- name: Delete SNK file
- run: rm ./Code/Light.SharedCore/Light.SharedCore.snk
+ run: rm ./Light.SharedCore/Light.SharedCore.snk
- name: Push nupkg package
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- run: dotnet nuget push "./Code/Light.SharedCore/bin/Release/Light.SharedCore.*.nupkg" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
+ run: dotnet nuget push "./Light.SharedCore/bin/Release/Light.SharedCore.*.nupkg" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
diff --git a/Code/Light.SharedCore.slnx b/Code/Light.SharedCore.slnx
deleted file mode 100644
index 17a4e8f..0000000
--- a/Code/Light.SharedCore.slnx
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/Code/Light.SharedCore/Light.SharedCore.Public.snk b/Code/Light.SharedCore/Light.SharedCore.Public.snk
deleted file mode 100644
index 6f81999..0000000
Binary files a/Code/Light.SharedCore/Light.SharedCore.Public.snk and /dev/null differ
diff --git a/Code/Light.SharedCore.Tests/Entities/GuidEntityTests.cs b/Light.SharedCore.Tests/Entities/GuidEntityTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Entities/GuidEntityTests.cs
rename to Light.SharedCore.Tests/Entities/GuidEntityTests.cs
diff --git a/Code/Light.SharedCore.Tests/Entities/Int32EntityTests.cs b/Light.SharedCore.Tests/Entities/Int32EntityTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Entities/Int32EntityTests.cs
rename to Light.SharedCore.Tests/Entities/Int32EntityTests.cs
diff --git a/Code/Light.SharedCore.Tests/Entities/Int64EntityTests.cs b/Light.SharedCore.Tests/Entities/Int64EntityTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Entities/Int64EntityTests.cs
rename to Light.SharedCore.Tests/Entities/Int64EntityTests.cs
diff --git a/Code/Light.SharedCore.Tests/Entities/StringEntityTests.cs b/Light.SharedCore.Tests/Entities/StringEntityTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Entities/StringEntityTests.cs
rename to Light.SharedCore.Tests/Entities/StringEntityTests.cs
diff --git a/Code/Light.SharedCore.Tests/Light.SharedCore.Tests.csproj b/Light.SharedCore.Tests/Light.SharedCore.Tests.csproj
similarity index 100%
rename from Code/Light.SharedCore.Tests/Light.SharedCore.Tests.csproj
rename to Light.SharedCore.Tests/Light.SharedCore.Tests.csproj
diff --git a/Code/Light.SharedCore.Tests/Parsing/DecimalParserTests.cs b/Light.SharedCore.Tests/Parsing/DecimalParserTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Parsing/DecimalParserTests.cs
rename to Light.SharedCore.Tests/Parsing/DecimalParserTests.cs
diff --git a/Code/Light.SharedCore.Tests/Parsing/DoubleParserTests.cs b/Light.SharedCore.Tests/Parsing/DoubleParserTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Parsing/DoubleParserTests.cs
rename to Light.SharedCore.Tests/Parsing/DoubleParserTests.cs
diff --git a/Code/Light.SharedCore.Tests/Parsing/FloatParserTests.cs b/Light.SharedCore.Tests/Parsing/FloatParserTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Parsing/FloatParserTests.cs
rename to Light.SharedCore.Tests/Parsing/FloatParserTests.cs
diff --git a/Code/Light.SharedCore.Tests/Time/CalculateIntervalForSameTimeNextDayTests.cs b/Light.SharedCore.Tests/Time/CalculateIntervalForSameTimeNextDayTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Time/CalculateIntervalForSameTimeNextDayTests.cs
rename to Light.SharedCore.Tests/Time/CalculateIntervalForSameTimeNextDayTests.cs
diff --git a/Code/Light.SharedCore.Tests/Time/CalculateIntervalUntilTests.cs b/Light.SharedCore.Tests/Time/CalculateIntervalUntilTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Time/CalculateIntervalUntilTests.cs
rename to Light.SharedCore.Tests/Time/CalculateIntervalUntilTests.cs
diff --git a/Code/Light.SharedCore.Tests/Time/LocalClockTests.cs b/Light.SharedCore.Tests/Time/LocalClockTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Time/LocalClockTests.cs
rename to Light.SharedCore.Tests/Time/LocalClockTests.cs
diff --git a/Code/Light.SharedCore.Tests/Time/TestClockTests.cs b/Light.SharedCore.Tests/Time/TestClockTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Time/TestClockTests.cs
rename to Light.SharedCore.Tests/Time/TestClockTests.cs
diff --git a/Code/Light.SharedCore.Tests/Time/TryConvertToTimeOfDayTests.cs b/Light.SharedCore.Tests/Time/TryConvertToTimeOfDayTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Time/TryConvertToTimeOfDayTests.cs
rename to Light.SharedCore.Tests/Time/TryConvertToTimeOfDayTests.cs
diff --git a/Code/Light.SharedCore.Tests/Time/UtcClockTests.cs b/Light.SharedCore.Tests/Time/UtcClockTests.cs
similarity index 100%
rename from Code/Light.SharedCore.Tests/Time/UtcClockTests.cs
rename to Light.SharedCore.Tests/Time/UtcClockTests.cs
diff --git a/Code/Light.SharedCore.Tests/testsettings.json b/Light.SharedCore.Tests/testsettings.json
similarity index 100%
rename from Code/Light.SharedCore.Tests/testsettings.json
rename to Light.SharedCore.Tests/testsettings.json
diff --git a/Light.SharedCore.slnx b/Light.SharedCore.slnx
new file mode 100644
index 0000000..23557d4
--- /dev/null
+++ b/Light.SharedCore.slnx
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/Light.SharedCore/CreateNuGetPackages.cmd b/Light.SharedCore/CreateNuGetPackages.cmd
similarity index 100%
rename from Code/Light.SharedCore/CreateNuGetPackages.cmd
rename to Light.SharedCore/CreateNuGetPackages.cmd
diff --git a/Code/Light.SharedCore/DatabaseAccessAbstractions/ISession.cs b/Light.SharedCore/DatabaseAccessAbstractions/ISession.cs
similarity index 100%
rename from Code/Light.SharedCore/DatabaseAccessAbstractions/ISession.cs
rename to Light.SharedCore/DatabaseAccessAbstractions/ISession.cs
diff --git a/Code/Light.SharedCore/Entities/EntityExtensions.cs b/Light.SharedCore/Entities/EntityExtensions.cs
similarity index 100%
rename from Code/Light.SharedCore/Entities/EntityExtensions.cs
rename to Light.SharedCore/Entities/EntityExtensions.cs
diff --git a/Code/Light.SharedCore/Entities/GuidEntity.cs b/Light.SharedCore/Entities/GuidEntity.cs
similarity index 100%
rename from Code/Light.SharedCore/Entities/GuidEntity.cs
rename to Light.SharedCore/Entities/GuidEntity.cs
diff --git a/Code/Light.SharedCore/Entities/IEntity.cs b/Light.SharedCore/Entities/IEntity.cs
similarity index 100%
rename from Code/Light.SharedCore/Entities/IEntity.cs
rename to Light.SharedCore/Entities/IEntity.cs
diff --git a/Code/Light.SharedCore/Entities/IMutableId.cs b/Light.SharedCore/Entities/IMutableId.cs
similarity index 100%
rename from Code/Light.SharedCore/Entities/IMutableId.cs
rename to Light.SharedCore/Entities/IMutableId.cs
diff --git a/Code/Light.SharedCore/Entities/Int32Entity.cs b/Light.SharedCore/Entities/Int32Entity.cs
similarity index 100%
rename from Code/Light.SharedCore/Entities/Int32Entity.cs
rename to Light.SharedCore/Entities/Int32Entity.cs
diff --git a/Code/Light.SharedCore/Entities/Int64Entity.cs b/Light.SharedCore/Entities/Int64Entity.cs
similarity index 100%
rename from Code/Light.SharedCore/Entities/Int64Entity.cs
rename to Light.SharedCore/Entities/Int64Entity.cs
diff --git a/Code/Light.SharedCore/Entities/StringEntity.cs b/Light.SharedCore/Entities/StringEntity.cs
similarity index 100%
rename from Code/Light.SharedCore/Entities/StringEntity.cs
rename to Light.SharedCore/Entities/StringEntity.cs
diff --git a/Code/Light.SharedCore/Light.SharedCore.csproj b/Light.SharedCore/Light.SharedCore.csproj
similarity index 87%
rename from Code/Light.SharedCore/Light.SharedCore.csproj
rename to Light.SharedCore/Light.SharedCore.csproj
index 8fdeb4b..2a059d2 100644
--- a/Code/Light.SharedCore/Light.SharedCore.csproj
+++ b/Light.SharedCore/Light.SharedCore.csproj
@@ -4,10 +4,10 @@
netstandard2.0;netstandard2.1
enable
13.0
- 2.0.0
+ 3.0.0
Kenny Pflug
Kenny Pflug
- Copyright © Kenny Pflug 2022, 2024
+ Copyright © Kenny Pflug 2022, 2025
Provides common abstractions and in-memory infrastructure for writing .NET apps.
database-access-abstractions;clock;number-parsing;entities
true
@@ -24,12 +24,10 @@
MIT
readme.md
-Light.SharedCore 2.0.0
+Light.SharedCore 3.0.0
--------------------------------
-- removed IAsyncFactory and service provider extensions
-- DatabaseAccessAbstractions is the new namespace containing session interfaces
-- reduced external dependencies
+- overhaul DatabaseAccessAbstractions: only ISession is left, all other interfaces were removed
- read all docs at https://github.com/feO2x/Light.SharedCore
diff --git a/Code/Light.SharedCore/Parsing/Cultures.cs b/Light.SharedCore/Parsing/Cultures.cs
similarity index 100%
rename from Code/Light.SharedCore/Parsing/Cultures.cs
rename to Light.SharedCore/Parsing/Cultures.cs
diff --git a/Code/Light.SharedCore/Parsing/DecimalParser.cs b/Light.SharedCore/Parsing/DecimalParser.cs
similarity index 100%
rename from Code/Light.SharedCore/Parsing/DecimalParser.cs
rename to Light.SharedCore/Parsing/DecimalParser.cs
diff --git a/Code/Light.SharedCore/Parsing/DoubleParser.cs b/Light.SharedCore/Parsing/DoubleParser.cs
similarity index 100%
rename from Code/Light.SharedCore/Parsing/DoubleParser.cs
rename to Light.SharedCore/Parsing/DoubleParser.cs
diff --git a/Code/Light.SharedCore/Parsing/FloatParser.cs b/Light.SharedCore/Parsing/FloatParser.cs
similarity index 100%
rename from Code/Light.SharedCore/Parsing/FloatParser.cs
rename to Light.SharedCore/Parsing/FloatParser.cs
diff --git a/Code/Light.SharedCore/Parsing/FloatingPointAnalysis.cs b/Light.SharedCore/Parsing/FloatingPointAnalysis.cs
similarity index 100%
rename from Code/Light.SharedCore/Parsing/FloatingPointAnalysis.cs
rename to Light.SharedCore/Parsing/FloatingPointAnalysis.cs
diff --git a/Code/Light.SharedCore/Parsing/FloatingPointAnalysisResult.cs b/Light.SharedCore/Parsing/FloatingPointAnalysisResult.cs
similarity index 100%
rename from Code/Light.SharedCore/Parsing/FloatingPointAnalysisResult.cs
rename to Light.SharedCore/Parsing/FloatingPointAnalysisResult.cs
diff --git a/Code/Light.SharedCore/Time/IClock.cs b/Light.SharedCore/Time/IClock.cs
similarity index 100%
rename from Code/Light.SharedCore/Time/IClock.cs
rename to Light.SharedCore/Time/IClock.cs
diff --git a/Code/Light.SharedCore/Time/LocalClock.cs b/Light.SharedCore/Time/LocalClock.cs
similarity index 100%
rename from Code/Light.SharedCore/Time/LocalClock.cs
rename to Light.SharedCore/Time/LocalClock.cs
diff --git a/Code/Light.SharedCore/Time/ServiceCollectionExtensions.cs b/Light.SharedCore/Time/ServiceCollectionExtensions.cs
similarity index 100%
rename from Code/Light.SharedCore/Time/ServiceCollectionExtensions.cs
rename to Light.SharedCore/Time/ServiceCollectionExtensions.cs
diff --git a/Code/Light.SharedCore/Time/TestClock.cs b/Light.SharedCore/Time/TestClock.cs
similarity index 100%
rename from Code/Light.SharedCore/Time/TestClock.cs
rename to Light.SharedCore/Time/TestClock.cs
diff --git a/Code/Light.SharedCore/Time/TimeExtensions.cs b/Light.SharedCore/Time/TimeExtensions.cs
similarity index 100%
rename from Code/Light.SharedCore/Time/TimeExtensions.cs
rename to Light.SharedCore/Time/TimeExtensions.cs
diff --git a/Code/Light.SharedCore/Time/UtcClock.cs b/Light.SharedCore/Time/UtcClock.cs
similarity index 100%
rename from Code/Light.SharedCore/Time/UtcClock.cs
rename to Light.SharedCore/Time/UtcClock.cs
diff --git a/readme.md b/readme.md
index efa9c07..1b4b06e 100644
--- a/readme.md
+++ b/readme.md
@@ -1,10 +1,11 @@
# Light.SharedCore
+
*Provides general abstractions, algorithms, and data structures for .NET*

[](https://github.com/feO2x/Light.SharedCore/blob/main/LICENSE)
-[](https://www.nuget.org/packages/Light.SharedCore/)
+[](https://www.nuget.org/packages/Light.SharedCore/)
# How to install
@@ -12,7 +13,7 @@ Light.SharedCore is compiled against [.NET Standard 2.0 and 2.1](https://docs.mi
Light.SharedCore is available as a [NuGet package](https://www.nuget.org/packages/Light.SharedCore/) and can be installed via:
-- **Package Reference in csproj**: ``
+- **Package Reference in csproj**: ``
- **dotnet CLI**: `dotnet add package Light.SharedCore`
- **Visual Studio Package Manager Console**: `Install-Package Light.SharedCore`
@@ -259,10 +260,8 @@ Prefer UTC time stamps, especially in services and when saving date and time val
## Database access abstractions
-This package offers interfaces for accessing databases. Both the `IAsyncSession` and `ISession` interfaces represent the [Unit-of-Work Design Pattern](https://www.martinfowler.com/eaaCatalog/unitOfWork.html). We strongly recommend to use `IAsyncSession` by default as all database I/O should be executed in an asynchronous fashion to avoid threads being blocked during database queries. This is especially important when you try to scale service apps. Incoming requests will usually be handled by executing code on the .NET Thread Pool (e.g. in ASP.NET Core) which in turn will create new threads when it sees that its worker threads are blocked. With a high number of concurrent requests, you might end up in a situation where your service app responds really slowly because of all the overhead of new threads being created and the context switches between them (thread starvation).
-
-However, some data access libraries do not support asynchronous queries. As of June 2024, e.g. SQLite did not override the asynchronous methods of ADO.NET - all calls will always be executed synchronously (even when you call the async APIs, like `DbConnection.OpenAsync`). You can resort to `ISession` in these circumstances. Please make sure that your ADO.NET provider overrides async methods properly.
+This package offers a new base interface for designing abstractions for database access. The `ISession` interface represents the [Unit-of-Work Design Pattern](https://www.martinfowler.com/eaaCatalog/unitOfWork.html) and offers a `Task SaveChangesAsync(CancellationToken)` method to explicitly trigger a commit to the underlying database access technology. This could be committing a transaction when using ADO.NET or Micro-ORMs like LinqToDB, Dapper, or MongoDB.Driver, as well as calling `SaveChangesAsync` on an Entity Framework Core `DbContext` for Full-ORMs. The `ISession` interface also derives from `IAsyncDisposable`. When the session is disposed before `SaveChangesAsync` is called, a rollback will be automatically executed by underlying implementations.
-There is also an `IAsyncReadOnlySession` interface that derives from both `IDisposable` and `IAsyncDisposable`. It can be used to create abstractions for sessions that only read data and do not require an explicit transaction.
+If you have been using Light.SharedCore in previous versions, you might wonder where the `IAsyncReadOnlySession` interface has gone. It has been removed in favor of simply using `IAsyncDisposable`. If you design database sessions that essentially behave like a client (without explicit transaction management by the caller), then simply derive your abstraction from `IAsyncDisposable` instead of the old `IAsyncReadOnlySession`. Also, all synchronous database interfaces as well as the sessions supporting transactions are gone (the current recommendation is to completely hide transaction objects like `DbTransaction` from business logic by implemeting specialized sessions).
-If you need to support several transactions during a database session, then use the `IAsyncTransactionalSession` (or `ITransactionalSession`) interfaces. Instead of a `SaveChangesAsync` method, you can use this session type to manually begin transactions by calling `BeginTransactionAsync`. You can then save your changes by committing the transaction. Please be aware that you should not nest transaction, i.e. you should not call `BeginTransactionAsync` again while you still have an existing transaction in your current scope.
\ No newline at end of file
+ All database I/O should be executed in an asynchronous fashion to avoid threads being blocked during database queries. This is especially important when you try to scale service apps. Incoming requests will normally be handled by executing code on the .NET Thread Pool (e.g. in ASP.NET Core) which in turn will create new threads when it sees that its worker threads are blocked. With a high number of concurrent requests, you might end up in a situation where your service app responds really slowly because of all the overhead of new threads being created and the context switches between them (thread starvation).
\ No newline at end of file