Fusonic.Extensions.Common
11.0.0
Prefix Reserved
dotnet add package Fusonic.Extensions.Common --version 11.0.0
NuGet\Install-Package Fusonic.Extensions.Common -Version 11.0.0
<PackageReference Include="Fusonic.Extensions.Common" Version="11.0.0" />
<PackageVersion Include="Fusonic.Extensions.Common" Version="11.0.0" />
<PackageReference Include="Fusonic.Extensions.Common" />
paket add Fusonic.Extensions.Common --version 11.0.0
#r "nuget: Fusonic.Extensions.Common, 11.0.0"
#:package Fusonic.Extensions.Common@11.0.0
#addin nuget:?package=Fusonic.Extensions.Common&version=11.0.0
#tool nuget:?package=Fusonic.Extensions.Common&version=11.0.0
Common
Package: Fusonic.Extensions.Common
This project contains general, framework independent utilities and abstractions.
PropertyUtil
Namespace: Fusonic.Extensions.Common.Reflection
Utility to get the names and types from property expressions.
Example:
public class RandomClass
{
public bool Flag { get; set; }
public string Title { get; set; } = "";
}
PropertyUtil.GetName<RandomClass>(c => c.Flag); // Returns "Flag"
PropertyUtil.GetType<RandomClass>(c => c.Title); // Returns typeof(string)
PropertyUtil.GetName<RandomClass>(c => c.GetType()); // Throws ArgumentException - .GetType() is no valid property expression
GetName<T, TResult>(Expression<Func<T, TResult>>) avoids boxing value type properties.
PathUtil
Namespace: Fusonic.Extensions.Common.IO
Utility for paths. Does not try to replicate System.IO.Path, but adds some helpers that Path doesn't.
Path.GetInvalidFileNameChars() returns different values based on the OS, while PathUtil uses a fixed set (the one of Windows, a superset of the others). This is useful e.g. when generating a filename for a download.
PathUtil.RemoveInvalidFilenameChars("a:b?.txt"); // "ab.txt"
PathUtil.RemoveInvalidPathChars(path);
PathUtil.HasInvalidFilenameChar(filename); // bool
PathUtil.HasInvalidPathChar(path); // bool
PathUtil.IsInvalidFilenameChar(c); // bool
PathUtil.IsInvalidPathChar(c); // bool
RemoveInvalidFilenameChars also removes all chars removed by RemoveInvalidPathChars.
TempFileStream
Namespace: Fusonic.Extensions.Common.IO
This creates a temporary file that gets automatically deleted when it is closed. Example:
await using (var fs = new TempFileStream())
{
// Write content to file
// Upload file
}
// File was deleted at this point.
The constructor takes an optional bufferSize (default 4096).
TransactionScopeHandler
Namespace: Fusonic.Extensions.Common.Transactions
ITransactionScopeHandler / TransactionScopeHandler provide an easy way to run code within a TransactionScope (with async flow enabled). The transaction options are:
IsolationLevel = IsolationLevel.ReadCommitted
Timeout = TransactionManager.MaximumTimeout
Register it in your container:
// Microsoft.Extensions.DependencyInjection
services.AddSingleton<ITransactionScopeHandler, TransactionScopeHandler>();
// SimpleInjector
container.RegisterSingleton<ITransactionScopeHandler, TransactionScopeHandler>();
With SimpleInjector, RegisterMediator from Fusonic.Extensions.Mediator already registers it when transactional decorators are enabled (the default). The methods are virtual, so you can derive from TransactionScopeHandler to change the behavior.
Example:
using System.Transactions;
// Runs async method FooMethod in a transaction. An ambient transaction gets used if it exists, otherwise a new one will be created.
await transactionScopeHandler.RunInTransactionScope(FooMethod);
// Runs the lambda in a new transaction.
var result = await transactionScopeHandler.RunInTransactionScope(async () => { await BarMethod(); return 42; }, TransactionScopeOption.RequiresNew);
// Runs LogMethod and suppresses any ambient transaction.
await transactionScopeHandler.RunInTransactionScope(LogMethod, TransactionScopeOption.Suppress);
// Shortcut for suppressing the transaction
await transactionScopeHandler.SuppressTransaction(LogMethod);
Entities
Namespace: Fusonic.Extensions.Common.Entities
IEntity/IEntity<TId>(with anIdproperty) mark your entities. They are used e.g. by the query extensions ofFusonic.Extensions.EntityFrameworkCore.EntityNotFoundExceptionsignals a missing entity. It has the optional propertiesEntityTypeandEntityId, e.g.throw new EntityNotFoundException(typeof(User), id);.
IUserAccessor
Namespace: Fusonic.Extensions.Common.Security
Abstraction to access the current user (ClaimsPrincipal User and bool TryGetUser(out ClaimsPrincipal user)). Fusonic.Extensions.AspNetCore provides HttpContextUserAccessor as implementation; Fusonic.Extensions.Hangfire requires one to be registered.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Fusonic.Extensions.Common:
| Package | Downloads |
|---|---|
|
Fusonic.Extensions.Hangfire
Provides Hangfire extensions, especially suited for CQRS development. (Out of band processing). |
|
|
Fusonic.Extensions.AspNetCore
Provides ASP.NET Core extensions (Middelwares, Utilities ...) |
|
|
Fusonic.Extensions.EntityFrameworkCore
Provides EF Core extensions (Utilities, helpers ...) |
|
|
Fusonic.Extensions.Mediator
Contains a simple implementation of the common mediator pattern. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0 | 0 | 11/23/2026 |
| 10.3.0 | 507 | 11/9/2026 |
| 10.2.0 | 359 | 11/5/2026 |
| 10.1.0 | 6,622 | 3/18/2026 |
| 10.0.1 | 212 | 3/17/2026 |
| 10.0.0 | 1,406 | 11/25/2025 |
| 10.0.0-rc.2 | 228 | 11/24/2025 |
| 10.0.0-rc.1 | 191 | 9/12/2025 |
| 9.5.4 | 892 | 8/20/2025 |
| 9.5.3 | 849 | 3/28/2025 |
| 9.5.2 | 957 | 1/16/2025 |
| 9.5.0 | 535 | 10/4/2024 |
| 9.4.0 | 584 | 9/23/2024 |
| 9.3.1 | 521 | 9/11/2024 |
| 9.3.0 | 407 | 9/11/2024 |
| 9.2.0 | 443 | 8/8/2024 |
| 9.2.0-rc.3 | 154 | 8/7/2024 |
| 9.2.0-rc.2 | 131 | 8/5/2024 |
| 9.2.0-rc.1 | 140 | 8/1/2024 |
| 9.1.0 | 357 | 7/29/2024 |