ModularSystem.Core
1.35.1
See the version list below for details.
dotnet add package ModularSystem.Core --version 1.35.1
NuGet\Install-Package ModularSystem.Core -Version 1.35.1
<PackageReference Include="ModularSystem.Core" Version="1.35.1" />
paket add ModularSystem.Core --version 1.35.1
#r "nuget: ModularSystem.Core, 1.35.1"
// Install ModularSystem.Core as a Cake Addin #addin nuget:?package=ModularSystem.Core&version=1.35.1 // Install ModularSystem.Core as a Cake Tool #tool nuget:?package=ModularSystem.Core&version=1.35.1
ModularSystem Core (Under Development)
Build a Solid Basic CRUD Within Minutes
This library streamlines the foundational tasks of setting up web servers. ModularSystem aims to automate repetitive aspects of web application development in a modular and simple manner.
Overview
ModularSystem provides a collection of useful classes for daily development tasks. The core philosophy is to maintain a stable API model to facilitate communication between different servers without requiring specific adaptation layers. This enables parsing and understanding the interface exposed by a server without data mapping, typing, or adaptation. The term 'Modular' reflects the system's extensibility, allowing developers to add modules to enhance functionality and promote code reuse.
CRUD Operations
The library offers complete CRUD (Create, Read, Update, Delete) operations, featuring a well-defined query mechanism based on Expression trees.
Generics
The entity interface employs a generic type T
, which inherits from a base class. This design allows the library to apply dynamic CRUD operations to any class. Developers will need to implement or override specific methods, where application-specific logic like validation and presentation can be added.
Entity Interface
The Entity Interface serves as the foundation for CRUD operations. It consolidates validation logic, data access layers, and much more to expose methods through the entity.
Getting Started
To begin, create the data structure for the entity model. This model should implement the
IQueryableModel
interface. Extend fromQueryableBase
to automatically implement all required methods.using ModularSystem.Core; class User : QueryableModel { public string Email { get; set; } public string Password { get; set; } }
Implement the IEntity<T> interface in the entity class. One approach is to extend from Entity<T> and implement the abstract methods.
using ModularSystem.Core; class UserEntity : Entity<User> { // ... }
The raw entity class requires implementation of certain methods and properties:
Example:
using ModularSystem.Core; class UserEntity : Entity<User> { protected IDataAccessObject<User> DataAccessObject { get; } public UserEntity() { //... } protected override MemberExpression CreateIdSelectorExpression (ParameterExpression parameter) { //... } protected override object? TryParseId(string id) { //... } }
The library also provides an Entity Framework implementation, with additional modules offering other implementations.
using ModularSystem.Core; class UserEntity : EFEntity<User> { protected IDataAccessObject<User> DataAccessObject { get; } public UserEntity() { //... } }
Data Access Object Interface (IDAO)
The IDataAccessObject interface houses the code for database access, serving as the entity's I/O interface for a given resource. The core library includes embedded implementations like EFCoreDataAccessObject.
using ModularSystem.Core;
class UserEntity : EFEntity<User>
{
protected IDataAccessObject<User> DataAccessObject { get; }
public UserEntity()
{
DataAccessObject = new EFCoreDataAccessObject<User>(new MyDbContext());
}
}
IValidator<T> Interface
Here you define data validation rules for specific data structures. Implement a validation method to return or throw exceptions if the data is in an invalid state.
public class UserValidator : IValidator<User>
{
public Task<Exception?> ValidateAsync(User instance)
{
//...
}
}
class UserEntity : EFEntity<User>
{
protected IDataAccessObject<User> DataAccessObject { get; }
public UserEntity()
{
DataAccessObject = new EFCoreDataAccessObject<User>(new MyDbContext());
Validator = new UserValidator();
}
}
Wiring it All Together
Entities can be utilized by other layers to create use cases, thus enabling clean and desired code behavior.
public class MyUseCase
{
public async Task DoSomeStuff()
{
var entity = new UserEntity();
var user = new User();
var id = await entity.CreateAsync(user);
}
public async Task DoSomeMoreStuff()
{
var entity = new UserEntity();
var query = new Query<User>().SetFilter(x => x.Email == "foo@bar.baz");
var queryResult = await entity.SearchAsync(query);
}
}
API Controller
Create a basic CRUD API with the ApiController base class, which generates GET, POST, PUT, and DELETE endpoints.
[Route("api/user")]
public class UserController : CrudController<User>
{
protected override IEntity<User> Entity { get; }
public UserController() : base()
{
Entity = new UserEntity();
}
}
WORK IN PROGRESS...
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Microsoft.EntityFrameworkCore (>= 7.0.10)
- Microsoft.EntityFrameworkCore.Sqlite (>= 7.0.10)
- MongoDB.Driver (>= 2.21.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ModularSystem.Core:
Package | Downloads |
---|---|
PlataformaOmega.IntegrationLibrary
Package Description |
|
Webql
... |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.40.0-prerelease.8 | 122 | 1/10/2024 |
1.40.0-prerelease.7 | 139 | 11/14/2023 |
1.40.0-prerelease.6 | 87 | 11/2/2023 |
1.40.0-prerelease.5 | 85 | 10/20/2023 |
1.40.0-prerelease.4 | 77 | 10/16/2023 |
1.40.0-prerelease.3 | 77 | 10/16/2023 |
1.40.0-prerelease.2 | 80 | 10/16/2023 |
1.40.0-prerelease.1 | 72 | 10/15/2023 |
1.39.1 | 203 | 9/28/2023 |
1.39.0 | 148 | 9/28/2023 |
1.38.2 | 133 | 9/27/2023 |
1.38.1 | 147 | 9/25/2023 |
1.38.0 | 134 | 9/19/2023 |
1.37.3 | 162 | 9/18/2023 |
1.37.2 | 110 | 9/18/2023 |
1.37.1 | 131 | 9/18/2023 |
1.37.0 | 166 | 9/13/2023 |
1.36.0 | 179 | 9/12/2023 |
1.35.6 | 159 | 9/12/2023 |
1.35.5 | 161 | 9/12/2023 |
1.35.4 | 167 | 9/11/2023 |
1.35.3 | 158 | 9/7/2023 |
1.35.2 | 142 | 9/6/2023 |
1.35.1 | 160 | 9/6/2023 |
1.35.0 | 165 | 9/6/2023 |
1.35.0-prerelease.42 | 100 | 8/31/2023 |
1.35.0-prerelease.41 | 80 | 8/31/2023 |
1.35.0-prerelease.40 | 101 | 8/30/2023 |
1.35.0-prerelease.39 | 94 | 8/30/2023 |
1.35.0-prerelease.38 | 100 | 8/29/2023 |
1.35.0-prerelease.37 | 91 | 8/27/2023 |
1.35.0-prerelease.36 | 86 | 8/26/2023 |
1.35.0-prerelease.35 | 86 | 8/26/2023 |
1.35.0-prerelease.34 | 83 | 8/26/2023 |
1.35.0-prerelease.33 | 82 | 8/26/2023 |
1.35.0-prerelease.32 | 89 | 8/25/2023 |
1.35.0-prerelease.31 | 100 | 8/25/2023 |
1.35.0-prerelease.30 | 91 | 8/25/2023 |
1.35.0-prerelease.29 | 92 | 8/25/2023 |
1.35.0-prerelease.28 | 84 | 8/25/2023 |
1.35.0-prerelease.27 | 90 | 8/25/2023 |
1.35.0-prerelease.26 | 80 | 8/25/2023 |
1.35.0-prerelease.25 | 87 | 8/25/2023 |
1.35.0-prerelease.24 | 86 | 8/25/2023 |
1.35.0-prerelease.23 | 93 | 8/24/2023 |
1.35.0-prerelease.22 | 91 | 8/24/2023 |
1.35.0-prerelease.21 | 86 | 8/23/2023 |
1.35.0-prerelease.20 | 82 | 8/23/2023 |
1.35.0-prerelease.19 | 80 | 8/23/2023 |
1.35.0-prerelease.18 | 93 | 8/19/2023 |
1.35.0-prerelease.17 | 86 | 8/19/2023 |
1.35.0-prerelease.16 | 95 | 8/19/2023 |
1.35.0-prerelease.15 | 80 | 8/18/2023 |
1.35.0-prerelease.14 | 86 | 8/16/2023 |
1.35.0-prerelease.13 | 83 | 8/16/2023 |
1.35.0-prerelease.12 | 87 | 8/15/2023 |
1.35.0-prerelease.11 | 95 | 8/14/2023 |
1.35.0-prerelease.10 | 94 | 8/13/2023 |
1.35.0-prerelease.9 | 94 | 8/13/2023 |
1.35.0-prerelease.8 | 98 | 8/9/2023 |
1.35.0-prerelease.7 | 109 | 8/2/2023 |
1.35.0-prerelease.6 | 96 | 8/2/2023 |
1.35.0-prerelease.5 | 103 | 8/2/2023 |
1.35.0-prerelease.4 | 88 | 8/2/2023 |
1.35.0-prerelease.2 | 128 | 8/1/2023 |
1.35.0-prerelease.1 | 105 | 7/25/2023 |
1.34.3 | 186 | 7/14/2023 |
1.34.2 | 207 | 7/11/2023 |
1.34.1 | 188 | 7/11/2023 |
1.34.0 | 153 | 7/11/2023 |
1.33.1 | 185 | 7/6/2023 |
1.33.0 | 189 | 7/6/2023 |
1.32.7 | 186 | 5/31/2023 |
1.32.6 | 241 | 5/31/2023 |
1.32.5 | 182 | 5/31/2023 |
1.32.4 | 174 | 5/31/2023 |
1.32.3 | 191 | 5/30/2023 |
1.32.2 | 235 | 5/30/2023 |
1.32.1 | 226 | 5/30/2023 |
1.32.0 | 167 | 5/26/2023 |
1.31.6 | 206 | 4/25/2023 |
1.31.5 | 212 | 4/25/2023 |
1.31.4 | 289 | 4/24/2023 |
1.31.3 | 224 | 4/21/2023 |
1.31.2 | 194 | 4/20/2023 |
1.31.1 | 136 | 4/14/2023 |
1.31.0 | 198 | 4/6/2023 |
1.30.0 | 135 | 4/4/2023 |
1.29.18 | 457 | 3/18/2023 |
1.29.17 | 336 | 3/18/2023 |
1.29.16 | 264 | 3/16/2023 |
1.29.15 | 264 | 3/16/2023 |
1.29.14 | 252 | 3/14/2023 |
1.29.13 | 536 | 3/9/2023 |
1.29.12 | 528 | 3/6/2023 |
1.29.11 | 274 | 3/3/2023 |
1.29.10 | 266 | 3/3/2023 |
1.29.9 | 360 | 3/2/2023 |
1.29.8 | 351 | 3/2/2023 |
1.29.7 | 627 | 3/1/2023 |
1.29.6 | 263 | 3/1/2023 |
1.29.5 | 359 | 2/27/2023 |
1.29.4 | 272 | 2/27/2023 |
1.29.3 | 283 | 2/25/2023 |
1.29.2 | 296 | 2/24/2023 |
1.29.1 | 309 | 2/24/2023 |
1.29.0 | 288 | 2/24/2023 |
1.28.4 | 275 | 2/22/2023 |
1.28.3 | 369 | 2/18/2023 |
1.28.2 | 289 | 2/18/2023 |
1.28.1 | 298 | 2/17/2023 |
1.28.0 | 455 | 2/16/2023 |
1.27.0 | 296 | 2/8/2023 |
1.26.3 | 305 | 2/7/2023 |
1.26.2 | 306 | 2/7/2023 |
1.26.1 | 295 | 2/7/2023 |
1.26.0 | 303 | 2/6/2023 |
1.25.21 | 313 | 2/4/2023 |
1.25.20 | 419 | 2/4/2023 |
1.25.19 | 310 | 2/4/2023 |
1.25.18 | 307 | 2/4/2023 |
1.25.17 | 297 | 2/3/2023 |
1.25.16 | 327 | 2/3/2023 |
1.25.15 | 304 | 1/28/2023 |
1.25.14 | 315 | 1/28/2023 |
1.25.13 | 315 | 1/27/2023 |
1.25.12 | 345 | 1/27/2023 |
1.25.11 | 475 | 1/27/2023 |
1.25.10 | 333 | 1/27/2023 |
1.25.9 | 414 | 1/20/2023 |
1.25.8 | 352 | 1/20/2023 |
1.25.7 | 350 | 1/20/2023 |
1.25.6 | 361 | 1/20/2023 |
1.25.5 | 330 | 1/20/2023 |
1.25.4 | 408 | 1/20/2023 |
1.25.3 | 332 | 1/20/2023 |
1.25.2 | 330 | 1/20/2023 |
1.25.1 | 339 | 1/19/2023 |
1.25.0 | 353 | 1/19/2023 |
1.24.4 | 581 | 1/13/2023 |
1.24.3 | 364 | 1/13/2023 |
1.24.2 | 342 | 1/13/2023 |
1.24.1 | 367 | 1/13/2023 |
1.24.0 | 343 | 1/13/2023 |
1.23.0 | 603 | 9/14/2022 |
1.22.0 | 507 | 8/27/2022 |
1.21.0 | 489 | 8/16/2022 |
1.20.1 | 524 | 8/4/2022 |
1.20.0 | 645 | 7/23/2022 |
1.19.3 | 534 | 7/8/2022 |
1.19.2 | 544 | 7/8/2022 |
1.19.1 | 934 | 7/7/2022 |
1.19.0 | 515 | 7/7/2022 |
1.18.10 | 660 | 7/6/2022 |
1.18.9 | 946 | 7/2/2022 |
1.18.8 | 516 | 7/2/2022 |
1.18.7 | 546 | 7/2/2022 |
1.18.6 | 542 | 7/2/2022 |
1.18.5 | 519 | 7/2/2022 |
1.18.4 | 516 | 7/2/2022 |
1.18.3 | 517 | 7/1/2022 |
1.18.2 | 529 | 6/28/2022 |
1.18.1 | 565 | 6/28/2022 |
1.18.0 | 509 | 6/27/2022 |
1.17.0 | 540 | 6/27/2022 |
1.16.8 | 556 | 5/16/2022 |
1.16.7 | 566 | 5/12/2022 |
1.16.6 | 570 | 5/10/2022 |
1.16.5 | 587 | 5/10/2022 |
1.16.4 | 568 | 5/10/2022 |
1.16.3 | 564 | 5/10/2022 |
1.16.2 | 588 | 4/30/2022 |
1.16.1 | 577 | 4/30/2022 |
1.16.0 | 575 | 4/30/2022 |
1.15.2 | 585 | 4/28/2022 |
1.15.1 | 568 | 4/27/2022 |
1.15.0 | 1,513 | 4/27/2022 |
1.14.8 | 586 | 4/1/2022 |
1.14.7 | 594 | 4/1/2022 |
1.14.6 | 602 | 4/1/2022 |
1.14.5 | 555 | 4/1/2022 |
1.14.4 | 622 | 3/27/2022 |
1.14.3 | 575 | 3/26/2022 |
1.14.2 | 587 | 3/25/2022 |
1.14.1 | 1,020 | 3/23/2022 |
1.14.0 | 569 | 3/23/2022 |
1.13.1 | 605 | 3/22/2022 |
1.13.0 | 582 | 3/22/2022 |
1.12.2 | 583 | 3/22/2022 |
1.12.1 | 774 | 3/22/2022 |
1.12.0 | 576 | 3/22/2022 |
1.11.2 | 616 | 3/11/2022 |
1.11.1 | 604 | 3/10/2022 |
1.11.0 | 585 | 3/10/2022 |
1.10.0 | 735 | 3/7/2022 |
1.9.2 | 633 | 3/3/2022 |
1.9.1 | 603 | 3/3/2022 |
1.9.0 | 1,681 | 2/26/2022 |
1.8.3 | 589 | 2/26/2022 |
1.8.2 | 607 | 2/1/2022 |
1.8.1 | 611 | 1/24/2022 |
1.8.0 | 619 | 1/24/2022 |
1.7.1 | 662 | 1/19/2022 |
1.7.0 | 616 | 1/19/2022 |
1.6.0 | 611 | 1/19/2022 |
1.5.0 | 636 | 1/19/2022 |
1.4.3 | 513 | 1/14/2022 |
1.4.2 | 510 | 1/14/2022 |
1.4.1 | 618 | 1/13/2022 |
1.4.0 | 513 | 1/13/2022 |
1.3.0 | 659 | 1/12/2022 |
1.2.0 | 520 | 1/11/2022 |
1.1.3 | 530 | 1/11/2022 |
1.1.2 | 512 | 1/11/2022 |
1.1.1 | 522 | 1/11/2022 |
1.1.0 | 520 | 1/11/2022 |
1.0 pattern consolidation.