Terminalogic.Essentials
1.0.1
See the version list below for details.
dotnet add package Terminalogic.Essentials --version 1.0.1
NuGet\Install-Package Terminalogic.Essentials -Version 1.0.1
<PackageReference Include="Terminalogic.Essentials" Version="1.0.1" />
<PackageVersion Include="Terminalogic.Essentials" Version="1.0.1" />
<PackageReference Include="Terminalogic.Essentials" />
paket add Terminalogic.Essentials --version 1.0.1
#r "nuget: Terminalogic.Essentials, 1.0.1"
#:package Terminalogic.Essentials@1.0.1
#addin nuget:?package=Terminalogic.Essentials&version=1.0.1
#tool nuget:?package=Terminalogic.Essentials&version=1.0.1
Terminalogic.Essentials
A lightweight enterprise utility framework for .NET applications providing streamlined database access, email handling, helper utilities, and identity management.
Overview
Terminalogic.Essentials is a reusable infrastructure package designed to simplify common backend operations in .NET applications.
The library provides:
- MSSQL database connectivity and query execution
- Email sending utilities
- Helper and utility functions
- Random and secure ID generators
- Basic identity and authentication classes
Built for rapid development, internal tooling, enterprise systems, APIs, Razor Pages, Web Apps, desktop applications, and automation platforms.
Features
Data Layer
Simplified Microsoft SQL Server access utilities.
Includes
- SQL Connection Management
- Dynamic Query Execution
- Parameterized Queries
- DataTable Support
- Scalar Queries
- Non-Query Execution
- Stored Procedure Support
- Transaction Handling
- Connection String Helpers
Example
using Terminalogic.Essentials.Data;
var db = new SqlData(connectionString);
DataTable dt = db.Read(
"SELECT * FROM Users WHERE UserId = @UserId",
"@UserId", 1
);
Email Utilities
Simple SMTP email handling for .NET applications.
Includes
- SMTP Email Sending
- HTML Email Support
- Attachments
- CC / BCC
- Authentication Support
- TLS/SSL Support
- Configurable SMTP Settings
Example
using Terminalogic.Essentials.Emails;
var email = new MailHelper();
email.Send(
smtpHost: "smtp.server.com",
port: 587,
username: "user@domain.com",
password: "password",
from: "noreply@domain.com",
to: "user@domain.com",
subject: "Test Email",
body: "<h1>Hello World</h1>",
isHtml: true
);
Helper Utilities
General purpose helper methods and utility classes.
Includes
- Random String Generators
- Secure Token Generators
- GUID Utilities
- String Helpers
- Date/Time Helpers
- Numeric Helpers
- Formatting Utilities
- Common Validation Functions
Example
using Terminalogic.Essentials.Helpers;
string randomId = RandomHelper.Generate(12);
Identity Classes
Basic identity and authentication infrastructure.
Includes
- User Models
- Authentication Helpers
- Password Hashing
- Session Helpers
- Login Models
- Identity DTOs
- Role Structures
- User Validation
Example
using Terminalogic.Essentials.ID;
var user = new AppUser
{
Username = "admin",
Email = "admin@domain.com"
};
Installation
Install via NuGet:
dotnet add package Terminalogic.Essentials
Or via Package Manager:
Install-Package Terminalogic.Essentials
Supported Frameworks
- .NET 8
- .NET 9
- ASP.NET Core
- Razor Pages
- MVC
- Console Applications
- Windows Services
- Desktop Applications
Project Structure
Terminalogic.Essentials
│
├── Data
│ ├── SQL Helpers
│ ├── Query Utilities
│ └── Database Models
│
├── Emails
│ ├── SMTP Helpers
│ └── Email Models
│
├── Helpers
│ ├── Random Generators
│ ├── Utility Functions
│ └── Formatting Helpers
│
└── ID
├── User Models
├── Authentication
└── Identity Helpers
Design Goals
Terminalogic.Essentials was built with the following goals:
- Minimal setup
- Rapid development
- Lightweight dependencies
- Enterprise-ready utilities
- Reusable architecture
- Easy integration
- Clean and consistent APIs
Example Use Cases
- Internal Business Applications
- Ticketing Systems
- Admin Dashboards
- Razor Pages Applications
- API Backends
- Inventory Systems
- Automation Platforms
- Reporting Systems
- Authentication Services
Security Notes
- Always store SMTP credentials securely
- Use parameterized queries
- Use SSL/TLS for email delivery
- Never store plain text passwords
- Use secure random generators for tokens
Contributing
Contributions, issues, and feature requests are welcome.
Please follow standard Git workflows and submit pull requests for review.
Versioning
This project follows Semantic Versioning.
Example:
MAJOR.MINOR.PATCH
License
MIT License
Author
Terminalogic
Enterprise Development Utilities for Modern .NET Applications
Links
- NuGet Package: https://www.nuget.org/
- Documentation: Coming Soon
- Source Repository: Coming Soon
Pasted text(9).txt Document
Pasted text (2)(1).txt
Document
Here rewrite the readme based on what I give you.
Data, Email, Helpers, ID
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using System.Net; using System.Net.Mail; using System.Text;
namespace Terminalogic { public sealed class Email { private readonly string _fromAddress; private readonly string _fromDisplayName; private readonly IConfiguration _configuration; private readonly ILogger<Email> _logger;
public Email(IConfiguration configuration, ILogger<Email> logger)
{
_configuration = configuration;
_logger = logger;
_fromAddress = configuration["Mail:FromAddress"]
?? configuration["Mail.FromAddress"]
?? "no-reply@example.com";
_fromDisplayName = configuration["Mail:FromDisplayName"]
?? configuration["Mail.FromDisplayName"]
?? "Application";
}
public bool TrySendPasswordResetEmail(string recipientEmail, string resetLink, out string? errorMessage)
{
if (string.IsNullOrWhiteSpace(recipientEmail))
{
errorMessage = "Recipient email must be provided.";
return false;
}
if (string.IsNullOrWhiteSpace(resetLink))
{
errorMessage = "Reset link must be provided.";
return false;
}
try
{
using var message = BuildPasswordResetMessage(recipientEmail.Trim(), resetLink);
using var smtpClient = new SmtpClient();
ApplySmtpSettings(smtpClient);
smtpClient.Send(message);
errorMessage = null;
return true;
}
catch (Exception ex)
{
_logger.LogError(ex, "Failed to send password reset email.");
errorMessage = ex.Message;
return false;
}
}
private void ApplySmtpSettings(SmtpClient client)
{
var host = _configuration["Smtp:Host"];
if (string.IsNullOrWhiteSpace(host))
return;
client.Host = host.Trim();
if (int.TryParse(_configuration["Smtp:Port"], out var port) && port > 0)
client.Port = port;
if (bool.TryParse(_configuration["Smtp:EnableSsl"], out var enableSsl))
client.EnableSsl = enableSsl;
var user = _configuration["Smtp:User"];
var password = _configuration["Smtp:Password"];
if (!string.IsNullOrEmpty(user))
client.Credentials = new NetworkCredential(user, password);
}
private MailMessage BuildPasswordResetMessage(string recipientEmail, string resetLink)
{
var from = new MailAddress(_fromAddress, _fromDisplayName);
var to = new MailAddress(recipientEmail);
var message = new MailMessage(from, to)
{
Subject = "Reset your password",
IsBodyHtml = true
};
var plainTextBody = new StringBuilder()
.AppendLine("You requested to reset your password.")
.AppendLine()
.AppendLine("If this was you, click the link below or paste it into your browser:")
.AppendLine(resetLink)
.AppendLine()
.AppendLine("If you did not request this, you can safely ignore this email.")
.AppendLine()
.AppendLine("— The Team")
.ToString();
var htmlBody = new StringBuilder()
.Append("<p>You requested to reset your password.</p>")
.Append("<p>If this was you, click the button below or copy and paste the link into your browser:</p>")
.AppendFormat("<p><a href=\"{0}\" style=\"display:inline-block;padding:12px 18px;background-color:#2563eb;color:#ffffff;border-radius:6px;text-decoration:none;\">Reset Password</a></p>", resetLink)
.AppendFormat("<p style=\"word-break:break-all;font-size:12px;color:#4b5563;\">{0}</p>", resetLink)
.Append("<p>If you did not request this, you can safely ignore this email.</p>")
.Append("<p>— The Team</p>")
.ToString();
message.Body = htmlBody;
message.AlternateViews.Add(AlternateView.CreateAlternateViewFromString(plainTextBody, null, "text/plain"));
return message;
}
}
}
using System.Security.Cryptography;
namespace Terminalogic { public sealed class Helpers { public string GenerateBusinessId() { return Guid.NewGuid().ToString("N").Substring(0, 12).ToUpperInvariant(); }
public string GenerateRandomKey(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var bytes = new byte[length];
RandomNumberGenerator.Fill(bytes);
var result = new char[length];
for (int i = 0; i < length; i++)
{
result[i] = chars[bytes[i] % chars.Length];
}
return new string(result);
}
}
}
Based on your actual implementation for Data, Email, Helpers, and Id classes
, here’s a rewritten professional README tailored specifically to Terminalogic.Essentials:
Terminalogic.Essentials
Lightweight enterprise infrastructure utilities for modern .NET applications.
Terminalogic.Essentials is a reusable utility framework built for ASP.NET Core and .NET applications that simplifies:
- MSSQL database access
- Email delivery
- Authentication and identity management
- Secure password handling
- Password reset token generation
- Random ID and key generation
- Common helper utilities
Designed for rapid development while maintaining secure and scalable application patterns.
Features
Data
The Data class provides simplified Microsoft SQL Server access utilities using Microsoft.Data.SqlClient.
Features
- Dynamic SQL query execution
- Automatic WHERE clause generation
- Stored procedure support
- Scalar query execution
- Parameterized queries
- SQL injection-safe parameter handling
- Connection testing
- Direct SqlConnection access
- Non-query write operations
The Email class provides SMTP email functionality with support for password reset workflows.
Features
- SMTP email sending
- HTML and plain text emails
- Password reset email templates
- SMTP authentication
- SSL/TLS support
- IConfiguration integration
- ILogger integration
- Error handling with TrySend pattern
Configuration Example
{
"Mail": {
"FromAddress": "no-reply@yourdomain.com",
"FromDisplayName": "Your Application"
},
"Smtp": {
"Host": "smtp.yourserver.com",
"Port": "587",
"EnableSsl": "true",
"User": "smtp-user",
"Password": "smtp-password"
}
}
Example
var success = email.TrySendPasswordResetEmail(
"user@domain.com",
resetLink,
out var errorMessage
);
Helpers
The Helpers class provides utility methods for generating secure IDs and random keys.
Features
- Business ID generation
- Secure random key generation
- Cryptographically secure randomization
Example
var helpers = new Helpers();
string businessId = helpers.GenerateBusinessId();
string randomKey = helpers.GenerateRandomKey(24);
ID
The Id class provides authentication and identity management functionality.
Features
- User creation
- Credential validation
- Password hashing using PBKDF2-SHA256
- Password reset token generation
- Password reset token validation
- Last login tracking
- Secure token hashing
- User lookup by ID or email
- Password updates
- Active user validation
Security Features
- PBKDF2 SHA256 password hashing
- Cryptographically secure salts
- Fixed-time password comparison
- Secure password reset token generation
- SHA256 token hashing
- Configurable iteration counts
Installation
Install via NuGet:
dotnet add package Terminalogic.Essentials
Dependency Injection Setup
Program.cs
builder.Services.AddSingleton<Data>();
builder.Services.AddSingleton<Helpers>();
builder.Services.AddSingleton<Id>();
builder.Services.AddSingleton<Email>();
Usage Examples
Reading Data
var table = data.Read(
"SELECT * FROM Users ORDER BY Id DESC",
"Email", "admin@domain.com"
);
Executing Stored Procedures
var table = data.Read(
"EXEC dbo.GetUsers",
"@IsActive", true
);
Scalar Queries
int count = data.ReadScalar<int>(
"SELECT COUNT(*) FROM Users",
null,
null
);
Writing Data
data.Write(
"INSERT INTO Users (Email, FirstName) VALUES (@Email, @FirstName)",
"Email", "admin@domain.com",
"FirstName", "Admin"
);
Creating Users
var user = id.CreateUser(
null,
"admin@domain.com",
"Password123!",
"John",
"Doe",
true
);
Validating Login Credentials
var user = id.ValidateCredentials(
"admin@domain.com",
"Password123!"
);
if (user != null)
{
// Authenticated
}
Password Reset Tokens
var token = id.CreatePasswordResetToken(
"admin@domain.com",
TimeSpan.FromHours(1)
);
Testing Database Connectivity
bool connected = data.TestConnection(
out var errorMessage
);
Supported Frameworks
- .NET 8
- .NET 9
- ASP.NET Core
- Razor Pages
- MVC
- Web APIs
- Console Applications
- Background Services
Architecture Goals
Terminalogic.Essentials was built with the following design principles:
- Lightweight
- Minimal boilerplate
- Secure by default
- Enterprise-ready
- Dependency injection friendly
- Reusable infrastructure
- Simple APIs
- Rapid development focused
Security Notes
- Passwords are hashed using PBKDF2 SHA256
- Password reset tokens are securely generated
- SQL parameters are automatically parameterized
- SMTP credentials should be stored securely
- Always use HTTPS for password reset links
Namespace
using Terminalogic;
Dependencies
- Microsoft.Data.SqlClient
- Microsoft.Extensions.Configuration
- Microsoft.Extensions.Logging
License
MIT License
Author
Terminalogic
Enterprise Utilities for Modern .NET Applications
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- Microsoft.AspNetCore.Components.Web (>= 8.0.26)
- Microsoft.Data.SqlClient (>= 5.2.2)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release