BlackDigital 26.10.20.19

dotnet add package BlackDigital --version 26.10.20.19
                    
NuGet\Install-Package BlackDigital -Version 26.10.20.19
                    
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="BlackDigital" Version="26.10.20.19" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlackDigital" Version="26.10.20.19" />
                    
Directory.Packages.props
<PackageReference Include="BlackDigital" />
                    
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 BlackDigital --version 26.10.20.19
                    
#r "nuget: BlackDigital, 26.10.20.19"
                    
#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 BlackDigital@26.10.20.19
                    
#: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=BlackDigital&version=26.10.20.19
                    
Install as a Cake Addin
#tool nuget:?package=BlackDigital&version=26.10.20.19
                    
Install as a Cake Tool

BlackDigital Framework

Logo

NuGet Version .NET License

A comprehensive .NET framework providing essential utilities, automatic REST service generation, advanced data annotations, and model helpers for modern application development.

🚀 Key Features

🌐 Automatic REST Services Generation ⭐

The flagship feature of BlackDigital! Create REST clients automatically through interfaces decorated with attributes. No more manual HTTP calls - just define your interface and let the framework handle the rest.

[Service("api/users", version: "2025-01-15")]
public interface IUserService
{
    [Action]
    Task<List<User>> GetAllUsers();
    
    [Action("{id}", Method = RestMethod.GET)]
    Task<User> GetUserById([Path] int id);
    
    [Action(Method = RestMethod.POST)]
    Task<User> CreateUser([Body] User user);
}

// Usage
var restClient = new RestClient("https://api.example.com");
var userService = new RestService<IUserService>(restClient);
var users = await userService.CallAsync(s => s.GetAllUsers());

📝 Advanced Data Annotations

Powerful validation and display control attributes that extend .NET's built-in capabilities:

public class UserRegistration
{
    [EmailMobile(ErrorMessage = "Enter a valid email or phone")]
    public string Contact { get; set; }
    
    [RequiredIfProperty("UserType", UserType.Business)]
    [ShowIfProperty("UserType", UserType.Business)]
    public string CompanyName { get; set; }
    
    [CompareValue("Password", Symbol.Equal)]
    public string ConfirmPassword { get; set; }
}

🏗️ Model Utilities

Base classes and interfaces for common patterns:

  • IId, IActive, ICreated, IUpdated, and IDeleted contracts
  • Audit base classes CreatedModel, UpdatedModel, and DeletedModel
  • Filtering and sorting helpers
  • Option lists and data builders

🛠️ Utility Classes

Essential helpers for everyday development:

  • HttpHelper - HTTP utilities and extensions
  • DateTimeHelper - Date/time manipulation
  • JsonCast - Shared JSON options with built-in converters for enums, Id, and TimeSpan
  • ReflectionHelper - Reflection utilities
  • ObjectHelper - Object manipulation
  • UriHelper - URI building and manipulation

📦 Installation

Install via NuGet Package Manager:

dotnet add package BlackDigital

Or via Package Manager Console:

Install-Package BlackDigital

🏃‍♂️ Quick Start

1. REST Services Example

using BlackDigital.Rest;

// Define your API interface
[Service("api/products", version: "2025-01-15")]
public interface IProductService
{
    [Action]
    Task<List<Product>> GetProducts([Query(QueryParameterType.Parameter)] string? search = null);
    
    [Action("{id}")]
    Task<Product> GetProduct([Path] int id);
    
    [Action(Method = RestMethod.POST)]
    Task<Product> CreateProduct([Body] Product product);
    
    [Action("{id}", Method = RestMethod.PUT)]
    Task<Product> UpdateProduct([Path] int id, [Body] Product product);
    
    [Action("{id}", Method = RestMethod.DELETE)]
    Task DeleteProduct([Path] int id);
}

// Configure and use
var client = new RestClient("https://api.mystore.com");
var productService = new RestService<IProductService>(client);

// Make calls
var products = await productService.CallAsync(s => s.GetProducts("laptop"));
var product = await productService.CallAsync(s => s.GetProduct(1));

2. Data Annotations Example

using BlackDigital.DataAnnotations;

public class ContactForm
{
    [Required]
    public string Name { get; set; }
    
    [EmailMobile(ErrorMessage = "Enter a valid email or phone number")]
    public string Contact { get; set; }
    
    public ContactType Type { get; set; }
    
    [RequiredIfProperty("Type", ContactType.Business)]
    [ShowIfProperty("Type", ContactType.Business)]
    public string CompanyName { get; set; }
    
    [ShowIfProperty("Type", ContactType.Personal)]
    public DateTime? BirthDate { get; set; }
}

3. Model Utilities Example

using BlackDigital.Model;

public class User : IId, IActive
{
    public Id Id { get; set; }
    public bool Active { get; set; }
    
    public string Name { get; set; }
    public string Email { get; set; }
}

public class AuditedUser : UpdatedModel
{
    public Id Id { get; set; }
    public string Name { get; set; }
}

// Use with filters
var activeUsers = query.FilterActive(true);
var pagedUsers = query.ApplyFilter(new BaseFilter { Take = 10 });

📚 Documentation

Core Documentation

Portuguese Documentation

🏗️ Architecture

The BlackDigital Framework is organized into several key components:

BlackDigital/
├── Rest/                    # Automatic REST service generation
│   ├── RestService<T>      # Main service class
│   ├── RestClient          # HTTP client wrapper
│   └── Attributes/         # Service, action, and parameter attributes
├── DataAnnotations/        # Advanced validation attributes
│   ├── Validation/         # Email, Mobile, RequiredIf, etc.
│   └── Display/           # ShowIf, NotShow, etc.
├── DataBuilder/           # Metadata inspection for dynamic UIs
├── Model/                 # Identification, audit, filters, and options
├── Converters/            # JSON converters for framework types
├── Authentication/        # Shared security abstractions
└── Utilities/             # Helper classes
    ├── HttpHelper         # HTTP utilities
    ├── JsonCast           # Shared JSON configuration
    └── ReflectionHelper   # Reflection utilities

🤝 Contributing

We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

  1. Clone the repository
  2. Open BlackDigital.sln in Visual Studio or your preferred IDE
  3. Build the solution
  4. Run tests to ensure everything works

Guidelines

  • Follow existing code style and conventions
  • Add tests for new features
  • Update documentation as needed
  • Ensure all tests pass before submitting PR

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

📞 Support

If you encounter any issues or have questions, please:

  1. Check the documentation
  2. Search existing issues
  3. Create a new issue if needed

BlackDigital Framework - Simplifying .NET development with powerful utilities and automatic REST service generation.

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.
  • net10.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on BlackDigital:

Package Downloads
BlackDigital.Blazor

Package Description

BlackDigital.Mvc

Package Description

BlackDigital.AspNet

BlackDigital ASP.NET Core Extensions

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.10.20.19 102 10/20/2026
26.10.14.19 101 10/14/2026
26.10.10.21 115 10/10/2026
25.10.8.15 300 10/8/2025
25.10.7.20 251 10/8/2025
25.10.2.12 266 10/2/2025
25.10.2.11 336 10/2/2025 25.10.2.11 is deprecated because it has critical bugs.
25.10.1.21 335 10/2/2025 25.10.1.21 is deprecated because it has critical bugs.
25.9.18.9 373 9/18/2025
25.6.4.10 340 6/4/2025
25.6.2.10 266 6/2/2025
25.1.20.18 227 1/20/2025
24.11.26.22 261 11/27/2024
24.9.23.14 366 9/23/2024
24.9.22.21 240 9/23/2024
23.9.6.1 472 9/6/2023
23.9.5.23 225 9/5/2023
23.9.5.20 225 9/5/2023
23.8.11.19 246 8/11/2023
23.6.2.22 306 6/2/2023
Loading failed