FoundationKit.Repository 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package FoundationKit.Repository --version 1.0.1
                    
NuGet\Install-Package FoundationKit.Repository -Version 1.0.1
                    
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="FoundationKit.Repository" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FoundationKit.Repository" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="FoundationKit.Repository" />
                    
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 FoundationKit.Repository --version 1.0.1
                    
#r "nuget: FoundationKit.Repository, 1.0.1"
                    
#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 FoundationKit.Repository@1.0.1
                    
#: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=FoundationKit.Repository&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=FoundationKit.Repository&version=1.0.1
                    
Install as a Cake Tool

FoundationKit

icon

The fundamental kit of your application, which offers key components such as repositories, validations, base models, and configurations.

This library is separated in 4 components or nuggets:

  • FoundationKit - Contains all implementations from the library.
  • FoundationKit.EntityFrameworkCore - Contains the base DbContext and base models, configurations and access configuration for database.
  • FoundationKit.Repository - Contains the base repositories.
  • FoundationKit.Extensions - Contains the extensions for the library.

Release to NuGet

[Roadmap]

Only mark items are completed

  • Repository Pattern
  • Repository Pattern with Automapper
  • Filter repository
  • Firebase Repository
  • AMQP RABBIT Integration
  • Validation
    • DPI
    • DNI
    • CreditCard
    • cvv validation
    • Date validation
    • Get credit card type
  • Configuration
    • Base Model ✅
    • Base Dto
    • Base Mappings
    • Base EF Configuration
    • Base Response
    • API key validation with swagger
    • Base SecurityApi key Model
    • Base Controllers
    • Base DbContext ✅
  • Services
    • Mail Service
    • SecurityKey Service
  • Helpers
    • Notification Helper (MVC)
    • Export Excel
    • RSA Encryption / Decryption
  • Extensions
    • Minimals api extensions
    • ICollection extensions
    • Enum extensions ✅
  • Documentation ✅

Documentation

this documentation represent the main features of the library separated by sections.

Repository Pattern

Is a common pattern used in the development of applications, which allows us to abstract the data access layer, in this way we can change the data source without affecting the rest of the application.

how to use it?

  • Create a interface and Class as service and use the inheritance of the base repository, passing a model as a generic parameter when the model is a class that inherits from the base model. BaseModel

//database context inheritance
public class ApplicationDbContext : FoundationKitDbContext
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
    {
    }
    public DbSet<Person> Persons { get; set; }
}

//using base model
public class Person : BaseModel
{
    public string? Name { get; set; }

    [NotMapped]
    public override string? CreatedBy { get; set; }
}

// inheritance base repository
public interface IPersonService
: IBaseRepository<Person>
{
}

// inheritance base repository and implementation of base repository
public class PersonService : BaseRepository<ApplicationDbContext, Person>, IPersonService
{
    public PersonService(ApplicationDbContext context) : base(context)
    {
    }
}

//usage in a minimal api endpoint
app.MapPost("/api/person", async ([FromServices] IPersonService service,
    Person person,
    CancellationToken cancellationToken) =>
    {
        return await service.Create(person, cancellationToken);
    })
    .WithName("add");

Configuration

Base Model

is a base class named BaseModel that allows us to have a common structure in our models, it has the following properties:

  • Id - is a unique identifier for the model.

  • CreatedAt - is the date of creation of the model.

  • UpdateAt - is the date of the last update of the model.

  • CreatedAtStr - is the date of creation of the model in string format. (dd/MM/yyyy hh:mm:ss)

  • UpdateAtStr - is the date of the last update of the model in string format. (dd/MM/yyyy hh:mm:ss)

  • IsDeleted - is a flag that indicates if the model is deleted.

  • CreatedBy - is the user who created the model.

  • UpdatedBy - is the user who updated the model.

Base DbContext

Contains the FoundationKitDbContext class which inherits from DbContext and contains the next characteristics:

  • SaveChanges: Override the SaveChanges method to set the CreatedAt and UpdateAt properties of the models.

  • SaveChangesAsync: Override the SaveChangesAsync method to set the CreatedAt and UpdateAt properties of the models.

Extensions

GetDisplayName

This extension allows us to obtain the name of the enum value based in the [Display] attribute if it exists, otherwise it returns the name of the enum based in your code.

Product 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.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on FoundationKit.Repository:

Package Downloads
FoundationKit

The fundamental kit of your application, which offers key components such as repositories, validations,base controllers, base models, and configurations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.5 197 11/27/2025
4.0.4 210 1/23/2025
4.0.3 173 1/23/2025
4.0.2 222 1/7/2025
4.0.1 173 1/7/2025
4.0.0 1,667 5/10/2024
3.0.0 542 10/6/2023
2.2.4 409 9/28/2023
2.1.4 244 9/21/2023
2.1.3 242 8/30/2023
2.1.2 230 8/30/2023
2.1.1 259 8/23/2023
2.0.7 250 8/23/2023
2.0.6 260 8/18/2023
2.0.5 264 8/9/2023
2.0.4 260 8/9/2023
2.0.3 258 8/8/2023
2.0.2 279 8/7/2023
2.0.1 277 8/1/2023
2.0.0 269 7/29/2023
1.1.2 300 7/11/2023
1.1.1 284 7/11/2023
1.0.1 260 7/10/2023
1.0.0 267 7/7/2023