eQuantic Core is a comprehensive .NET library that provides a rich set of utilities, extensions, and design pattern implementations to enhance your applications. This library serves as the foundation for the entire eQuantic ecosystem.
| Package | Description | NuGet |
|---|---|---|
eQuantic.Core |
Core utilities, extensions, collections | |
eQuantic.Core.Eventing |
Base eventing abstractions (IEvent, IEventHandler, IEventDispatcher) |
- PagedList: Generic paged collection implementation
- IPagedEnumerable: Interface for paged enumerations with metadata (PageIndex, PageSize, TotalCount)
Comprehensive extension methods for common .NET types:
- StringExtensions: Advanced string manipulation (LeftOf, RightOf, RemoveDiacritics, Slugify, etc.)
- TaskExtensions: Async/await utilities and task management
- TypeExtensions: Reflection helpers and type utilities
- EnumerableExtensions: LINQ extensions and collection utilities
- DateTimeExtensions: Date and time manipulation helpers
- ExceptionExtensions: Exception handling utilities
- GuidExtensions: GUID manipulation helpers
- ListExtensions: List-specific extension methods
- EnumExtensions: Enumeration utilities and helpers
Advanced date and time manipulation tools:
- TimeTool: Comprehensive time calculations and manipulations
- TimeFormatter: Flexible time formatting utilities
- DateDiff: Date difference calculations
- SystemClock: Clock abstraction for testability
- Time: Advanced time operations
- TimeCompare: Time comparison utilities
- IEncrypting: Encryption interface with encoding capabilities
- Encryptor: Default encryption implementation
- IContainer: IoC container interface for dependency injection
- ICaching: Caching interface with generic support
- ShortGuid: Base64-encoded GUID implementation for shorter string representations
- RegNumberValidation: Registration number validation utilities
- MethodExtractorVisitor: Expression tree method extraction
- LocalizedDescriptionAttribute: Localized description attribute for enums
- StringConstants: Common string constants
- DateTimeConverterISO8601: ISO 8601 DateTime converter
- HttpFile: HTTP file handling utilities
Install eQuantic.Core via NuGet Package Manager:
dotnet add package eQuantic.CoreOr via Package Manager Console:
Install-Package eQuantic.Coreusing eQuantic.Core.Collections;
// Create a paged list
var items = new List<string> { "item1", "item2", "item3" };
var pagedList = new PagedList<string>(items, totalCount: 100)
{
PageIndex = 1,
PageSize = 10
};
Console.WriteLine($"Page {pagedList.PageIndex} of {Math.Ceiling((double)pagedList.TotalCount / pagedList.PageSize)}");using eQuantic.Core.Extensions;
string text = "Hello World";
string left = text.LeftOf(' '); // "Hello"
string right = text.RightOf(' '); // "World"
string withAccents = "OlΓ‘, mΓ£o!";
string slugified = withAccents.Slugify(); // "ola-mao"
string dirty = "Remove<script>alert('xss')</script>text";
string clean = dirty.UnHtml(); // "Removetext"using eQuantic.Core;
// Generate a new short GUID (22 characters instead of 36)
ShortGuid shortId = ShortGuid.NewGuid();
Console.WriteLine(shortId.ToString()); // e.g., "FEx1sZbaCUifqz7VAp3j_g"
// Convert from regular GUID
Guid regularGuid = Guid.NewGuid();
ShortGuid fromGuid = new ShortGuid(regularGuid);
// Convert back to GUID
Guid converted = fromGuid.ToGuid();using eQuantic.Core.Date;
// Advanced date operations
DateTime date = DateTime.Now;
DateTime startOfWeek = TimeTool.GetStartOfWeek(date, DayOfWeek.Monday);
DateTime dateOnly = TimeTool.GetDate(date);
DateTime withNewTime = TimeTool.SetTimeOfDay(date, 14, 30, 0); // 2:30 PM
// Date difference calculations
DateDiff diff = new DateDiff(DateTime.Now.AddDays(-30), DateTime.Now);
Console.WriteLine($"Difference: {diff.Days} days");using eQuantic.Core.Extensions;
Type stringType = typeof(string);
bool isNullable = stringType.IsNullable(); // false
Type nullableInt = typeof(int?);
bool isNullableInt = nullableInt.IsNullable(); // true
// Get all types implementing an interface
var implementingTypes = typeof(IDisposable).GetImplementingTypes();using eQuantic.Core.Cache;
public class MyService
{
private readonly ICaching _cache;
public MyService(ICaching cache)
{
_cache = cache;
}
public async Task<string> GetDataAsync(string key)
{
if (!_cache.IsNull(key))
{
return _cache.Get<string>(key);
}
var data = await FetchDataFromSourceAsync(key);
_cache.Add(data, key, timeout: 60); // Cache for 60 minutes
return data;
}
}- .NET Standard 2.1
- .NET 6.0
- .NET 8.0
- .NET 10.0
We welcome contributions! Please feel free to submit pull requests or open issues to discuss potential improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
eQuantic Core is part of the eQuantic ecosystem. Check out these related packages:
- eQuantic.Core.CQS - CQS/CQRS pattern with Mediator, Sagas, Outbox
- eQuantic.Core.DomainEvents - Domain Events for DDD
- eQuantic.Core.Api - API, Domain, Application layers
- eQuantic.Core.Api.Crud - CRUD operations
For support, please visit our GitHub Issues page.
eQuantic Tech - Building the future, one component at a time.