Arhimede.Lib
1.0.11
dotnet add package Arhimede.Lib --version 1.0.11
NuGet\Install-Package Arhimede.Lib -Version 1.0.11
<PackageReference Include="Arhimede.Lib" Version="1.0.11" />
<PackageVersion Include="Arhimede.Lib" Version="1.0.11" />
<PackageReference Include="Arhimede.Lib" />
paket add Arhimede.Lib --version 1.0.11
#r "nuget: Arhimede.Lib, 1.0.11"
#:package Arhimede.Lib@1.0.11
#addin nuget:?package=Arhimede.Lib&version=1.0.11
#tool nuget:?package=Arhimede.Lib&version=1.0.11
Arhimede.Lib
Utility library for .NET applications with helpers for string processing, period formatting, validation, object cloning, diff models, and email sending.
Target framework
- .NET 10 (
net10.0)
Package dependencies
- MailKit
- Microsoft.Extensions.Configuration
- Microsoft.Extensions.Options
Features
- General utility methods in
Biblio - Period formatting helpers in
Perioade - Validation attributes for IBAN and SSN/VAT values
- JSON-based object cloning extension
- Email sending support with MailKit
- DI registration helper for library services
- Simple diff result models
Main components
Biblio
Biblio contains a large set of helper methods. From the currently exposed code, common examples include:
TrimWhiteSpaces(object obj)- trims all string properties on an objectStrExtract(...)- extracts substrings between delimitersAt(...)- finds string positions- validation helpers used by the custom attributes
Example:
using Arhimede;
var person = new Person
{
FirstName = " John ",
LastName = " Doe "
};
Biblio.TrimWhiteSpaces(person);
Validation attributes
The library includes:
IBANAttributeSSNAttribute
Example:
using Arhimede.Attributes;
using System.ComponentModel.DataAnnotations;
public class CustomerInput
{
[IBAN]
public string? Iban { get; set; }
[SSN]
public string? PersonalOrVatNumber { get; set; }
}
SystemExtension.Clone<T>()
Provides a simple deep-clone style helper via JSON serialization.
Example:
using Arhimede;
var cloned = original.Clone();
Perioade
Perioade provides Romanian text formatting for date intervals through TextPer(DateTime datai, DateTime dataf, bool abreviat = false).
It can format:
- a single day
- a date range within the same month
- a full month
- a full quarter
- a full semester
- a full year
- cross-month and cross-year intervals
Examples:
using Arhimede.Biblio;
result = TextPer(new DateTime(2024, 1, 1), new DateTime(2024, 1, 31), true);
// "ian. 2024"
result = TextPer(new DateTime(2024, 1, 1), new DateTime(2024, 3, 31), true);
// "2024 Trim.1"
result = TextPer(new DateTime(2024, 1, 1), new DateTime(2024, 6, 30), false);
// "2024 Semestrul 1"
result = TextPer(new DateTime(2024, 2, 10), new DateTime(2024, 2, 20), true);
// "10-20.02.2024"
Email support
Models
EmailConfiguration
public class EmailConfiguration
{
public string From { get; set; }
public string SmtpServer { get; set; }
public int Port { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
Message
var message = new Message(
new[] { "recipient@example.com" },
"Test subject",
"Email body"
);
Registering services
The library exposes an extension method for dependency injection:
using Arhimede;
services.AddLibServices();
This registers:
IEmailService→EmailService
Sending email
Example:
using Arhimede.Email;
using Arhimede.Models;
var emailConfig = new EmailConfiguration
{
From = "sender@example.com",
SmtpServer = "smtp.example.com",
Port = 465,
UserName = "sender@example.com",
Password = "your-password"
};
var service = new EmailService(emailConfig);
var message = new Message(
new[] { "receiver@example.com" },
"Hello",
"This is a test email."
);
service.SendEmail(message);
Diff models
The library currently exposes:
DifferenceDiffResults
These can be used to represent property-level comparison results in higher-level application code.
Installation
If you reference the project directly:
<ProjectReference Include="Arhimede.Lib.csproj" />
If you publish it as a NuGet package, add the package reference normally in your consuming project.
Notes
Clone<T>()relies onSystem.Text.Jsonserialization.EmailServiceexpects a validEmailConfigurationinstance.AddLibServices()registers the email service, but the configuration object must still be provided by the consuming application.
License
This repository includes LICENSE.txt.
| Product | Versions 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. |
-
net10.0
- Dapper (>= 2.1.72)
- MailKit (>= 4.16.0)
- Microsoft.Data.SqlClient (>= 7.0.1)
- Microsoft.Extensions.Configuration (>= 10.0.7)
- Microsoft.Extensions.Options (>= 10.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.