FoundationKit.Repository
2.0.1
See the version list below for details.
dotnet add package FoundationKit.Repository --version 2.0.1
NuGet\Install-Package FoundationKit.Repository -Version 2.0.1
<PackageReference Include="FoundationKit.Repository" Version="2.0.1" />
<PackageVersion Include="FoundationKit.Repository" Version="2.0.1" />
<PackageReference Include="FoundationKit.Repository" />
paket add FoundationKit.Repository --version 2.0.1
#r "nuget: FoundationKit.Repository, 2.0.1"
#:package FoundationKit.Repository@2.0.1
#addin nuget:?package=FoundationKit.Repository&version=2.0.1
#tool nuget:?package=FoundationKit.Repository&version=2.0.1
FoundationKit
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.
Configuration in program.cs:
//this configuration is necessary if you want use IMapRepository with IdentityDbContext
builder.Services.AddFoundationKitIdentity<User, ApplicationIdentityDbContext>(Assembly.GetExecutingAssembly());
//this configuration is necessary if you want use IMapRepository without IdentityDbContext
builder.Services.AddFoundationKit(Assembly.GetExecutingAssembly());
[Roadmap]
Only mark items are completed
- Repository Pattern ✅
- Repository Pattern with Automapper ✅
- Filter repository
- Firebase Repository
- AMQP RABBIT Integration
- Services
- NationalityService
- StateService
- CountryService
- Validation
- DPI
- DNI
- CreditCard
- cvv validation
- Date validation
- Get credit card type
- Configuration
- Base Model ✅
- Base Dto ✅
- Paginate ✅
- Base Mappings
- Base EF Configuration ✅
- Base Response
- API key validation with swagger
- Base SecurityApi key Model
- Core API Controllers✅
- Core MVC Controllers
- Base DbContext ✅
- Services
- Mail Service
- SecurityKey Service
- Helpers
- Notification Helper (MVC)
- Export Excel
- RSA Encryption / Decryption,
- Format amounts
- MD5 HASH
- Extensions
- Minimals api extensions
- ICollection extensions
- Enum extensions ✅
- Others
- Cookie based auth
- 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.
Paginate
is a class named Paginate that allows us to paginate a list of models; please see the paginate class.
Core API Controllers
Contains the CoreApiController class which inherits from ControllerBase and contains the next characteristics:
GetByIdAsync- is a method that allows us to obtain a model by its id.GetAllPaginatedAsync- is a method that allows us to obtain all the models paginated or not please see Paginate.AddAsync- is a method that allows us to create a model.UpdateAsync- is a method that allows us to update a model.DeleteAsync- is a method that allows up to update a model with theIsDeletedflag in true.
Example in FoundationKit.API.Example/Controllers/PersonController.cs
Base DbContext
Contains the FoundationKitDbContext class which inherits from DbContext and contains the next characteristics:
SaveChanges: Override theSaveChangesmethod to set theCreatedAtandUpdateAtproperties of the models.SaveChangesAsync: Override theSaveChangesAsyncmethod to set theCreatedAtandUpdateAtproperties 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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. 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. |
-
net7.0
- AutoMapper (>= 12.0.1)
- FoundationKit.Domain (>= 2.0.1)
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 |