![]() |
VOOZH | about |
dotnet add package eQuantic.Core.Api.Client --version 1.9.3
NuGet\Install-Package eQuantic.Core.Api.Client -Version 1.9.3
<PackageReference Include="eQuantic.Core.Api.Client" Version="1.9.3" />
<PackageVersion Include="eQuantic.Core.Api.Client" Version="1.9.3" />Directory.Packages.props
<PackageReference Include="eQuantic.Core.Api.Client" />Project file
paket add eQuantic.Core.Api.Client --version 1.9.3
#r "nuget: eQuantic.Core.Api.Client, 1.9.3"
#:package eQuantic.Core.Api.Client@1.9.3
#addin nuget:?package=eQuantic.Core.Api.Client&version=1.9.3Install as a Cake Addin
#tool nuget:?package=eQuantic.Core.Api.Client&version=1.9.3Install as a Cake Tool
The eQuantic Core API provides all the implementation needed to publish standard APIs.
To install eQuantic.Core.Api, run the following command in the Package Manager Console
Install-Package eQuantic.Core.Api
[Table("orders")]
public class OrderData : EntityDataBase
{
[Key]
public string Id { get; set; } = string.Empty;
public DateTime Date { get; set; }
public virtual ICollection<OrderItemData> Items { get; set; } = new HashSet<OrderItemData>();
}
[Table("orderItems")]
public class OrderItemData : EntityDataBase, IWithReferenceId<OrderItemData, int>
{
[Key]
public int Id { get; set; }
public int OrderId { get; set; }
[ForeignKey(nameof(OrderId))]
public virtual OrderData? Order { get; set; }
[Required]
[MaxLength(200)]
public string Name { get; set; } = string.Empty;
}
public class Order
{
public string Id { get; set; } = string.Empty;
public DateTime Date { get; set; }
}
public class OrderItem
{
public int Id { get; set; }
public int OrderId { get; set; }
public string Name { get; set; } = string.Empty;
}
public class OrderRequest
{
public DateTime? Date { get; set; }
}
public class OrderItemRequest
{
public string? Name { get; set; }
}
public class OrderMapper : IMapper<OrderData, Order>, IMapper<OrderRequest, OrderData>
{
public Order? Map(OrderData? source)
{
return Map(source, new Order());
}
public Order? Map(OrderData? source, Order? destination)
{
if (source == null)
{
return null;
}
if (destination == null)
{
return Map(source);
}
destination.Id = source.Id;
destination.Date = source.Date;
return destination;
}
public OrderData? Map(OrderRequest? source)
{
return Map(source, new OrderData());
}
public OrderData? Map(OrderRequest? source, OrderData? destination)
{
if (source == null)
{
return null;
}
if (destination == null)
{
return Map(source);
}
destination.Date = source.Date ?? DateTime.UtcNow;
return destination;
}
}
public interface IOrderService : IApplicationService
{
}
[MapCrudEndpoints]
public class OrderService : IOrderService
{
private readonly IMapperFactory _mapperFactory;
private readonly ILogger<ExampleService> _logger;
private readonly IAsyncQueryableRepository<IQueryableUnitOfWork, OrderData, int> _repository;
public OrderService(
IApplicationContext<int> applicationContext,
IQueryableUnitOfWork unitOfWork,
IMapperFactory mapperFactory,
ILogger<OrderService> logger)
{
_mapperFactory = mapperFactory;
_logger = logger;
_repository = unitOfWork.GetAsyncQueryableRepository<IQueryableUnitOfWork, OrderData, int>();
}
public async Task<Order?> GetByIdAsync(int orderId, CancellationToken cancellationToken = default)
{
var item = await _repository.GetAsync(orderId, cancellationToken: cancellationToken);
if (item == null)
{
var ex = new EntityNotFoundException<int>(orderId);
_logger.LogError(ex, "{ServiceName} - GetById: Entity of {EntityName} not found", GetType().Name,
nameof(OrderData));
throw ex;
}
var mapper = _mapperFactory.GetMapper<OrderData, Order>()!;
var result = mapper.Map(item);
return result;
}
}
Program.csvar builder = WebApplication.CreateBuilder(args);
var assembly = typeof(Program).Assembly;
builder.Services.AddDbContext<ExampleDbContext>(opt =>
opt.UseInMemoryDatabase("ExampleDb"));
builder.Services.AddQueryableRepositories<ExampleUnitOfWork>(opt =>
{
opt.FromAssembly(assembly)
.AddLifetime(ServiceLifetime.Scoped);
});
builder.Services
.AddMappers(opt => opt.FromAssembly(assembly))
.AddTransient<IExampleService, ExampleService>()
.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
})
.AddFilterModelBinder()
.AddSortModelBinder();
builder.Services
.AddEndpointsApiExplorer()
.AddApiDocumentation(opt => opt.WithTitle("Example API"));
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseApiDocumentation();
}
app.UseHttpsRedirection();
app.UseRouting();
app.MapControllers();
app.MapGet("orders/{id}", GetById);
app.Run();
return;
async Task<Results<Ok<Order>, NotFound>> GetById(
[FromRoute] int id,
[FromServices] IOrderService service,
CancellationToken cancellationToken)
{
var item = await service.GetByIdAsync(id, cancellationToken);
if (item == null)
return TypedResults.NotFound();
return TypedResults.Ok(item);
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 1 NuGet packages that depend on eQuantic.Core.Api.Client:
| Package | Downloads |
|---|---|
|
eQuantic.Core.Api.Crud.Client
eQuantic Api CRUD Client Library |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.9.3 | 131 | 3/2/2026 |
| 1.9.2 | 618 | 6/22/2025 |
| 1.9.1 | 238 | 6/22/2025 |
| 1.9.0 | 217 | 6/22/2025 |
| 1.8.2 | 188 | 6/21/2025 |
| 1.8.1 | 267 | 6/17/2025 |
| 1.8.0 | 235 | 5/30/2025 |
| 1.7.23 | 266 | 5/10/2025 |
| 1.7.22 | 207 | 4/19/2025 |
| 1.7.21 | 195 | 4/19/2025 |
| 1.7.20 | 217 | 2/27/2025 |
| 1.7.19 | 219 | 2/23/2025 |
| 1.7.18 | 210 | 2/18/2025 |
| 1.7.17 | 267 | 1/21/2025 |
| 1.7.16 | 424 | 1/10/2025 |
| 1.7.15 | 194 | 1/8/2025 |
| 1.7.14 | 212 | 12/27/2024 |
| 1.7.13 | 295 | 11/20/2024 |
| 1.7.12 | 235 | 11/20/2024 |
| 1.7.11 | 206 | 11/19/2024 |
Conventions for API Client Layer