MelloSilveiraTools 1.4.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MelloSilveiraTools --version 1.4.0
                    
NuGet\Install-Package MelloSilveiraTools -Version 1.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MelloSilveiraTools" Version="1.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MelloSilveiraTools" Version="1.4.0" />
                    
Directory.Packages.props
<PackageReference Include="MelloSilveiraTools" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MelloSilveiraTools --version 1.4.0
                    
#r "nuget: MelloSilveiraTools, 1.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MelloSilveiraTools@1.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MelloSilveiraTools&version=1.4.0
                    
Install as a Cake Addin
#tool nuget:?package=MelloSilveiraTools&version=1.4.0
                    
Install as a Cake Tool

MelloSilveiraTools

A suite of .NET 10 NuGet packages with helpers for system development: extension methods, infrastructure (database, logging, resilience, encryption), web-API helpers, a runtime plugin system, and engineering toolkits (mathematics, mechanics of materials).

Packages

Pick the contextual packages your application actually needs, or install the meta-package for everything.

Package What it ships Depends on
MelloSilveiraTools.Core Extension methods, ILogger + file logger, in-memory single/two-level caches, Polly resilience pipelines, encryption (PBKDF2), SMTP email
MelloSilveiraTools.Database IRepository, PostgresRepository, ISqlProvider, attribute-driven SQL generation, filter clauses, Npgsql/Dapper extensions, dedicated Postgres resilience pipeline Core
MelloSilveiraTools.WebApi CustomControllerBase, CrudController<TEntity, TFilter>, ExceptionHandlingMiddleware, NDJSON streaming, JWE bearer authentication, Swagger bootstrap, ApiServiceAgent, OperationBase / OperationResponse Core, Database
MelloSilveiraTools.Plugins File-based plugin runtime, two-level cache, dynamic DI, persistence (file/database), HTTP-friendly operations, background orchestrator Core, Database, WebApi
MelloSilveiraTools.Mathematics Differential equation solvers (Newmark, Newmark-β), function system (constant/polynomial/exponential/sine/cosine/power-law + factory), expressions (PronySeries), numerical integration (Simpson), differentiation, root-finding (Bisection, Brent), statistics, 3D geometry (Point3D, Vector3D), unit converter Core
MelloSilveiraTools.MechanicsOfMaterials Fatigue (Goodman/Marin), constitutive equations, geometric properties (circular/rectangular profiles), 3D vector/force models, mechanical models (elastic, linear/non-linear/quasi-linear viscoelastic), load-sharing calculator Mathematics
MelloSilveiraTools Meta-package: ProjectReferences for every package above; install once and get everything all of the above

Quick start

Everything in one go

services.AddToolsServices(
    databaseSettings,
    encryptionSettings,
    resiliencePipelineSettings,
    pluginSettings,
    loggerSettings);

AddToolsServices (from the meta-package) chains AddCoreServices, AddDatabaseServices, AddMathematicsServices, AddMechanicsOfMaterialsServices, AddPluginServices and AddWebApiServices. JWE auth and Swagger remain opt-in.

Granular wire-up

services
    .AddCoreServices(encryptionSettings, resiliencePipelineSettings, loggerSettings)
    .AddDatabaseServices(databaseSettings, resiliencePipelineSettings)
    .AddWebApiServices(resiliencePipelineSettings)
    .AddJweAuthentication(jwtSettings)
    .AddSwaggerWithBearerSecurity()
    .AddMathematicsServices()
    .AddMechanicsOfMaterialsServices()
    .AddPluginServices(pluginSettings);

A worker that just talks to PostgreSQL and writes file logs only needs:

services
    .AddCoreServices(encryptionSettings, resiliencePipelineSettings)
    .AddDatabaseServices(databaseSettings, resiliencePipelineSettings);

— no ASP.NET, JWT, Swagger, plugins or Polly-for-SMTP transitive dependencies.

HTTP endpoints

Both MVC controllers and minimal-API endpoint extensions ship side-by-side; consumers pick whichever style matches their host. The classic controllers (CustomControllerBase, CrudController<TEntity, TFilter>, PluginController) remain available for hosts that already wire app.MapControllers(). New projects can use the equivalent minimal-API extensions instead:

// Generic CRUD over an entity + filter pair (alongside CrudController<TEntity, TFilter>):
app.MapCrud<MyEntity, MyFilter>(pattern: "/api/v1/things", resourceName: "thing");

// Plugin management (alongside PluginController):
app.MapPluginEndpoints("/api/v1/plugins");

MapCrud exposes the same surface the controller does: POST /, GET /{id:long}, GET / (filter + pagination), PUT /{id:long}, DELETE /{id:long} and GET /stream (NDJSON). NDJSON streaming is also available standalone via httpContext.WriteNdjsonAsync(asyncSequence, logger, resourceName).

AOT compatibility

Every package opts in to <IsAotCompatible>true</IsAotCompatible>. The trim/AOT diagnostic warnings (IL2026, IL3050, etc.) are silenced via <NoWarn> at the project level, so the toolkit doesn't propagate [RequiresUnreferencedCode]/[RequiresDynamicCode] annotations on its public surface. Where reflection-target preservation matters, [DynamicallyAccessedMembers] annotations are kept so the trimmer keeps the right members.

In prose: Core, Mathematics and MechanicsOfMaterials are AOT-clean. Database and WebApi build AOT-clean but exercise reflection at runtime (Dapper materialization, attribute-driven SQL, Swashbuckle's Newtonsoft adapter); consumers publishing AOT will see those trim warnings in their own analyzers when they call into those paths and must accept them or replace with source-generated equivalents. Plugins is fundamentally not AOT-publishable: AssemblyLoadContext.LoadFromAssemblyPath cannot work in a published AOT app.

Plugin system

A complete plugin architecture that lets a host application discover, load and hot-swap external assemblies dropped into a folder, with their services automatically registered into the DI container.

Capabilities

  • File-based discovery. DLLs named {name}.v{major}.{minor}.{patch}.dll are scanned from the configured plugin directory. Once loaded they are moved to a loaded/ subfolder.
  • Two registration modes.
    • Startup: services registered against the root IServiceCollection (IPluginService.LoadPluginsOnStartup).
    • Runtime: services registered against an IDynamicServiceProvider (IPluginService.LoadPluginsOnRuntime), so plugins can come and go without restarting the host.
  • Type processors. Implement IPluginTypeProcessor to teach the system how to register a particular base type (interface or class) found inside a plugin assembly. The processor receives a PluginRegistrationContext that exposes either the IServiceCollection (startup) or the IDynamicServiceProvider (runtime).
  • Two-level cache. PluginCache keys by plugin name and PluginVersion. Entries progress through DiscoveredPluginLoadedPluginRegisteredPlugin, with RegisteredPlugin.IsFullyLoaded / FullyLoadedAt marking the final stage.
  • Persistence. IPluginCachePersistence snapshots the cache to non-volatile storage. Two implementations ship out of the box (PluginCacheTargets.File, PluginCacheTargets.Database); consumers can add their own keyed implementations and the existing endpoints route to them via the {target} route value. The fallback used outside an HTTP request is configurable via PluginSettings.DefaultCacheTarget.
  • Background orchestrator. PluginOrchestratorBackgroundService polls the plugin folder periodically (PluginSettings.PollInterval) and:
    • ignores files whose version is lower than the highest currently-loaded version, logging a warning;
    • skips files already fully loaded;
    • loads higher versions through LoadPluginsOnRuntime and evicts older cached versions, keeping the version immediately below the new one until PluginSettings.PreviousVersionRetention elapses.
  • Application operations. Ready-to-use operations (GetPlugins, LoadPlugins, ReloadPlugins, ClearPluginCache, PersistPluginCache, RestorePluginCache) wrap IPluginService for HTTP exposure.

Wire-up

services.AddPluginServices(new PluginSettings
{
    Directory = "/var/app/plugins",
    PollInterval = TimeSpan.FromSeconds(30),
    PreviousVersionRetention = TimeSpan.FromHours(24),
    DefaultCacheTarget = PluginCacheTargets.File
});

AddPluginServices registers everything needed (cache, persistences, processors, orchestrator) and eagerly runs LoadPluginsOnStartup against the supplied IServiceCollection before returning. This must happen during DI configuration: once the host is built the collection is sealed, so any later registration would be discarded.

File naming

MyCompany.Plugins.Reporting.v1.2.3.dll
^---------- name -----------^^ version ^

PluginVersion parses the v{major}.{minor}.{patch} suffix and supports comparison operators, so the orchestrator can decide whether a file is newer than what is already loaded.

Mathematics

MelloSilveiraTools.Mathematics ships the following toolkits. The DI entry point (AddMathematicsServices) registers only the differential-equation solvers; the rest are used directly without injection.

Differential equation solversNewmarkMethod, NewmarkBetaMethod (registered via DI), DifferentialEquationMethodFactory.

Function systemFunction abstract class with lazy Derivative / Integral properties. Concrete types: ConstantFunction, PolynomialFunction, ExponencialFunction, SineFunction, CosineFunction, PowerLaw, GenericFunction. Create by enum via FunctionFactory.

ExpressionsExpression (sum of Function instances) and PronySeries (c + Σ aₙ·e^(aₙx)).

Numerical methodsSimpsonRuleIntegration (integral), Derivative (finite-difference), BisectionMethod / BrentMethod / RootFinding / StepByStepMethod (root-finding, all implement IRootFinding).

StatisticsIStatisticsCalculator / StatisticsCalculator.

Geometry and utilitiesPoint3D, Vector3D, UnitConverter, CustomMath / MathematicConstants, Vector3DExtension, DoubleExtensions.

services.AddMathematicsServices();

Mechanics of Materials

MelloSilveiraTools.MechanicsOfMaterials provides the following calculators. The DI entry point (AddMechanicsOfMaterialsServices) registers only the fatigue, constitutive equations, and geometric-property calculators; mechanical models and load sharing are used directly.

FatigueIFatigueCalculator / FatigueCalculator (Goodman/Marin criteria, registered via DI).

Constitutive equationsIConstitutiveEquationsCalculator / ConstitutiveEquationsCalculator (registered via DI).

Geometric propertiesIGeometricPropertyCalculator<CircularProfile> / IGeometricPropertyCalculator<RectangularProfile> (registered via DI).

Mechanical models — generic IMechanicalModelCalculator<TInput> (force, displacement, stress, strain). Implementations: ElasticModelCalculator; linear viscoelastic MaxwellModelCalculator; non-linear viscoelastic SchaperyModelCalculator, ModifiedSuperpositionMethodCalculator; quasi-linear viscoelastic FungModelCalculator, SimplifiedFungModelCalculator.

Load sharingILoadSharingCalculator / LoadShare1DTissueThreeDimensionalSpaceCalculator (specimen displacement, angle, force projection and derivatives in 3-D space).

3D force model — immutable Force struct; use Sum/Subtract/Round/Divide/Abs/Create to derive new instances.

services.AddMechanicsOfMaterialsServices();
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.5.0-rc046 88 9/4/2026
1.5.0-rc045 85 9/1/2026
1.5.0-rc044 111 8/3/2026
1.5.0-rc043 102 8/1/2026
1.5.0-rc042 97 8/1/2026
1.5.0-rc041 105 8/1/2026
1.5.0-rc040 110 7/31/2026
1.5.0-rc039 108 7/30/2026
1.5.0-rc038 107 7/21/2026
1.5.0-rc037 108 7/21/2026
1.5.0-rc036 121 6/30/2026
1.5.0-rc035 116 6/24/2026
1.5.0-rc034 114 6/23/2026
1.5.0-rc033 121 6/23/2026
1.5.0-rc032 118 6/23/2026
1.5.0-rc031 131 6/22/2026
1.5.0-rc030 121 6/22/2026
1.5.0-rc029 113 6/21/2026
1.5.0-rc028 128 6/20/2026
1.4.0 222 5/1/2026
Loading failed

See CHANGELOG.md for the full list of changes.