NuGet

eQuantic Core Library

Core functionality and abstractions for building robust applications

Version: 1.8.0

Downloads: 86K+

Status: stable

Category: core

Installation

dotnet add package eQuantic.Core

Overview

The eQuantic Core Library is the foundation of the entire eQuantic ecosystem, providing essential abstractions and base functionality for building robust and scalable applications.

This library implements proven architectural patterns such as Domain-Driven Design (DDD), Clean Architecture, and SOLID principles, offering a solid foundation for enterprise development.

With over 50,000 downloads, it's the most used library in the eQuantic ecosystem, providing standardized interfaces for repositories, services, and domain entities.

Quick Start

1. Basic Setup

Configure basic eQuantic Core services in your project.

public void ConfigureServices(IServiceCollection services)
{
    services.AddEQuantic()
        .AddDataAccess()
        .AddRepositories();
}

2. Creating an Entity

Define your domain entities by inheriting from base classes.

public class Product : Entity<int>
{
    public string Name { get; private set; }
    public decimal Price { get; private set; }
    
    public Product(string name, decimal price)
    {
        Name = name;
        Price = price;
    }
    
    public void UpdatePrice(decimal newPrice)
    {
        Price = newPrice;
        AddDomainEvent(new PriceUpdatedEvent(Id, newPrice));
    }
}

3. Implementing a Repository

Use repository interfaces for data access.

public class ProductService
{
    private readonly IRepository<Product> _repository;
    
    public ProductService(IRepository<Product> repository)
    {
        _repository = repository;
    }
    
    public async Task<Product> GetByIdAsync(int id)
    {
        return await _repository.GetByIdAsync(id);
    }
    
    public async Task<IEnumerable<Product>> GetActiveProductsAsync()
    {
        var spec = new ActiveProductsSpecification();
        return await _repository.GetAsync(spec);
    }
}

API Reference

interface

IRepository<T>

Generic interface for repositories with basic CRUD operations.

Example
Task<T> GetByIdAsync(TKey id);
Task<IEnumerable<T>> GetAsync(ISpecification<T> spec);
Task AddAsync(T entity);
Task UpdateAsync(T entity);
Task DeleteAsync(T entity);
class

Entity<TKey>

Base class for domain entities with typed primary key.

Example
public abstract class Entity<TKey> : IEntity<TKey>
{
    public TKey Id { get; protected set; }
    public DateTime CreatedAt { get; protected set; }
    public DateTime? UpdatedAt { get; protected set; }
}
interface

ISpecification<T>

Interface to implement the Specification pattern.

Example
public class ActiveProductsSpecification : ISpecification<Product>
{
    public Expression<Func<Product, bool>> Criteria => p => p.IsActive;
    public List<Expression<Func<Product, object>>> Includes { get; }
}

Key Features

Repository Abstractions

Generic interfaces for data access with support for CRUD operations, pagination, and complex specifications.

Domain Entities

Base classes for entities, aggregates, and value objects following DDD principles.

Specifications

Implementation of the Specification pattern to create complex and reusable queries.

Domain Events

Event system for communication between bounded contexts and side effects implementation.

Value Objects

Base classes for value objects with automatic validation and value-based comparison.

Package Info

Version
1.8.0
Downloads
86K+
Status
stable
Category
core
eQuantic Core Library - Documentation | eQuantic