Zonit.Extensions.Databases.Abstractions
0.0.13
See the version list below for details.
dotnet add package Zonit.Extensions.Databases.Abstractions --version 0.0.13
NuGet\Install-Package Zonit.Extensions.Databases.Abstractions -Version 0.0.13
<PackageReference Include="Zonit.Extensions.Databases.Abstractions" Version="0.0.13" />
<PackageVersion Include="Zonit.Extensions.Databases.Abstractions" Version="0.0.13" />
<PackageReference Include="Zonit.Extensions.Databases.Abstractions" />
paket add Zonit.Extensions.Databases.Abstractions --version 0.0.13
#r "nuget: Zonit.Extensions.Databases.Abstractions, 0.0.13"
#:package Zonit.Extensions.Databases.Abstractions@0.0.13
#addin nuget:?package=Zonit.Extensions.Databases.Abstractions&version=0.0.13
#tool nuget:?package=Zonit.Extensions.Databases.Abstractions&version=0.0.13
The extension facilitates CRUD creation in databases.
It speeds up the work of creating repositories, with the help of abstractions and interface handle the connection to the database.
Nuget Package Abstraction
Install-Package Zonit.Extensions.Databases.Abstractions
Nuget Package Extensions SqlServer
Install-Package Zonit.Extensions.Databases.SqlServer
Example:
Model
public class Blog
{
public Guid Id { get; set; }
public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public DateTime Created { get; private set; } = DateTime.UtcNow;
}
internal class BlogDto(Blog x)
{
public string Id { get; set; } = $"Id: {x.Id}";
public string Title { get; set; } = $"Title: {x.Title}";
public string Content { get; set; } = $"Content: {x.Content}";
public string Created { get; set; } = $"Created: {x.Created:G}";
}
Repository
public interface IBlogRepository : IDatabaseRepository<Blog, Guid>
{ }
internal class BlogRepository(DatabaseContext _context) : DatabaseRepository<Blog, Guid>(_context), IBlogRepository
{ }
public interface IBlogsRepository : IDatabasesRepository<Blog>
{ }
internal class BlogsRepository(IDbContextFactory<DatabaseContext> _context) : DatabasesRepository<Blog, DatabaseContext>(_context), IBlogsRepository
{ }
Register
builder.Services.AddDbSqlServer<DatabaseContext>();
builder.Services.AddTransient<IBlogRepository, BlogRepository>();
builder.Services.AddTransient<IBlogsRepository, BlogsRepository>();
Create
var blog = await _blogRepository.AddAsync(new Blog
{
Title = "Hello World",
Content = "Example content"
});
Read single
var blogSingle = await _blogRepository.GetAsync(x => x.Title == "Hello World");
var blogSingleDto = await _blogRepository.GetAsync<BlogDto>(x => x.Title == "Hello World");
Read first
var blogFirst = await _blogRepository.GetFirstAsync(x => x.Title == "Hello World");
var blogFirstDto = await _blogRepository.GetFirstAsync<BlogDto>(x => x.Title == "Hello World");
Update
var blog = await _blogRepository.GetFirstAsync(x => x.Title == "Hello World");
blog.Title = "New Title";
var update = await _blogRepository.UpdateAsync(blog);
Delete
var delete = await _blogRepository.DeleteAsync(blog.Id);
Read All
using var repository = _blogsRepository;
var blogs = await repository.GetAsync();
var blogsDto = await repository.GetAsync<BlogDto>();
API IDatabaseRepository<TEntity, TType>
Task<TEntity> AddAsync(TEntity entity);
Task<TEntity?> GetAsync(TType id);
Task<TDto?> GetAsync<TDto>(TType id);
Task<TEntity?> GetAsync(Expression<Func<TEntity, bool>> predicate);
Task<TDto?> GetAsync<TDto>(Expression<Func<TEntity, bool>> predicate);
Task<TEntity?> GetFirstAsync(Expression<Func<TEntity, bool>> predicate);
Task<TDto?> GetFirstAsync<TDto>(Expression<Func<TEntity, bool>> predicate);
Task<bool> UpdateAsync(TEntity entity);
Task<bool> DeleteAsync(TType entity);
API IDatabasesRepository<TEntity>
IDatabasesRepository<TEntity> Skip(int skip);
IDatabasesRepository<TEntity> Take(int take);
IDatabasesRepository<TEntity> Include(Expression<Func<TEntity, object>> includeExpression);
IDatabasesRepository<TEntity> Where(Expression<Func<TEntity, bool>> predicate);
IDatabasesRepository<TEntity> OrderBy(Expression<Func<TEntity, object>> keySelector);
IDatabasesRepository<TEntity> OrderByDescending(Expression<Func<TEntity, object>> keySelector);
IDatabasesRepository<TEntity> Select(Expression<Func<TEntity, TEntity>> selector);
Task<IReadOnlyCollection<TEntity>> GetAsync();
Task<IReadOnlyCollection<TDto>> GetAsync<TDto>();
Task<int> GetCountAsync();
For more information, see the Examples project.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Zonit.Extensions.Databases.Abstractions:
| Package | Downloads |
|---|---|
|
Zonit.Extensions.Databases.SqlServer
SQL Server implementation of Zonit.Extensions.Databases - provides Entity Framework Core-based repository patterns with flexible CRUD operations, dynamic query building, DTO support, and seamless integration of external or computed data from any source. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.54 | 59 | 1/12/2026 |
| 1.0.53 | 104 | 1/6/2026 |
| 1.0.52 | 105 | 1/4/2026 |
| 1.0.51 | 101 | 1/2/2026 |
| 1.0.50 | 420 | 11/18/2025 |
| 1.0.13 | 211 | 8/12/2025 |
| 1.0.12 | 332 | 6/12/2025 |
| 1.0.11 | 341 | 6/11/2025 |
| 1.0.10 | 329 | 6/11/2025 |
| 1.0.9 | 193 | 5/29/2025 |
| 1.0.8 | 191 | 5/28/2025 |
| 1.0.7 | 193 | 5/28/2025 |
| 1.0.6 | 124 | 5/24/2025 |
| 1.0.5 | 198 | 5/19/2025 |
| 1.0.4 | 213 | 5/7/2025 |
| 1.0.3 | 172 | 4/25/2025 |
| 1.0.2 | 223 | 4/23/2025 |
| 1.0.1 | 238 | 4/22/2025 |
| 1.0.0 | 165 | 4/19/2025 |
| 0.1.14 | 158 | 4/19/2025 |
| 0.1.13 | 168 | 4/19/2025 |
| 0.1.12 | 269 | 4/18/2025 |
| 0.1.11 | 259 | 4/17/2025 |
| 0.1.10 | 261 | 4/17/2025 |
| 0.1.9 | 259 | 4/17/2025 |
| 0.1.8 | 261 | 4/17/2025 |
| 0.1.7 | 259 | 4/17/2025 |
| 0.1.6 | 277 | 4/16/2025 |
| 0.1.5 | 180 | 1/29/2025 |
| 0.1.4 | 214 | 6/13/2024 |
| 0.1.3 | 184 | 6/5/2024 |
| 0.1.2 | 186 | 6/4/2024 |
| 0.1.1 | 193 | 6/4/2024 |
| 0.1.0 | 197 | 6/3/2024 |
| 0.0.13 | 200 | 5/1/2024 |
| 0.0.12 | 178 | 4/28/2024 |
| 0.0.11 | 216 | 4/24/2024 |
| 0.0.10 | 189 | 4/22/2024 |
| 0.0.9 | 199 | 4/21/2024 |
| 0.0.8 | 209 | 4/21/2024 |
| 0.0.7 | 223 | 4/18/2024 |
| 0.0.6 | 187 | 4/18/2024 |