ISM.EFCore 1.0.40
I.S.M. EFCore (Entity Framework Core)
🏷️ Introduction
This project provides a sample implementation of Entity Framework Core (EFCore) in a .NET application. It demonstrates how to set up and use EFCore for data access and management, including features such as repositories, unit of work, and soft delete.
💡 Usage Examples
Example of use in a service
public class UserService
{
private readonly IRepository<User, Guid> _users;
private readonly IUnitOfWork _unitOfWork;
public UserService(IRepository<User, Guid> users, IUnitOfWork unitOfWork)
{
_users = users;
_unitOfWork = unitOfWork;
}
public async Task CreateUserAsync(User user, CancellationToken cancellationToken = default)
{
await _users.AddAsync(user, cancellationToken);
await _unitOfWork.SaveChangesAsync(cancellationToken);
}
public async Task<PagedResult<User>> GetUsersAsync(int pageNumber, int pageSize, CancellationToken cancellationToken = default)
{
return await _users.GetPagedAsync(
pageNumber,
pageSize,
orderBy: q => q.OrderBy(x => x.Id),
cancellationToken);
}
}
Example of an entity
public class User : IEntity<Guid>
{
public Guid Id { get; set; }
public string Email { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
}
DbContext with global soft delete
public class AppDbContext(DbContextOptions<AppDbContext> options, ICurrentUserService currentUserService) : BaseDbContext(options, currentUserService)
{
//public virtual DbSet<User> Users { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
Example of registering 3 entities
services.AddPersistence<User, Guid, AppDbContext>();
services.AddPersistence<Order, Guid, AppDbContext>();
services.AddPersistence<Product, Guid, AppDbContext>();
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
Showing the top 20 packages that depend on ISM.EFCore.
| Packages | Downloads |
|---|---|
|
ISM.Extensions.FileSystem
File System library for Identity System Management
|
1 |
|
ISM.Extensions.FileSystem
File System library for Identity System Management
|
4 |
|
ISM.Extensions.FileSystem
File System library for Identity System Management
|
6 |
.NET 10.0
- ISM.Shared (>= 1.0.20)
- Microsoft.EntityFrameworkCore (>= 10.0.7)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.7)
| Version | Downloads | Last updated |
|---|---|---|
| 1.0.57 | 1 | 07/05/2026 |
| 1.0.56 | 5 | 06/15/2026 |
| 1.0.54 | 7 | 06/04/2026 |
| 1.0.53 | 1 | 05/30/2026 |
| 1.0.52 | 11 | 05/24/2026 |
| 1.0.51 | 7 | 05/20/2026 |
| 1.0.50 | 5 | 05/19/2026 |
| 1.0.46 | 6 | 05/19/2026 |
| 1.0.44 | 5 | 05/17/2026 |
| 1.0.43 | 2 | 05/16/2026 |
| 1.0.42 | 2 | 05/14/2026 |
| 1.0.40 | 4 | 05/13/2026 |
| 1.0.35 | 4 | 05/12/2026 |
| 1.0.34 | 7 | 05/09/2026 |
| 1.0.33 | 1 | 05/08/2026 |
| 1.0.31 | 9 | 05/05/2026 |
| 1.0.27 | 3 | 05/03/2026 |
| 1.0.20 | 3 | 05/02/2026 |
| 1.0.17 | 3 | 05/01/2026 |
| 1.0.16 | 1 | 05/01/2026 |
| 1.0.15 | 1 | 05/01/2026 |
| 1.0.1 | 2 | 04/26/2026 |