BaseLib.Core
2.1.0.1
See the version list below for details.
dotnet add package BaseLib.Core --version 2.1.0.1
NuGet\Install-Package BaseLib.Core -Version 2.1.0.1
<PackageReference Include="BaseLib.Core" Version="2.1.0.1" />
paket add BaseLib.Core --version 2.1.0.1
#r "nuget: BaseLib.Core, 2.1.0.1"
// Install BaseLib.Core as a Cake Addin #addin nuget:?package=BaseLib.Core&version=2.1.0.1 // Install BaseLib.Core as a Cake Tool #tool nuget:?package=BaseLib.Core&version=2.1.0.1
BaseLib.Core
Overview
BaseLib.Core
is a foundational library for building backend services in .NET. It simplifies the creation of services by providing base classes that implement common patterns and functionalities.
BaseLib.Core services are platform-agnostic, meaning they can run in various environments, such as containers, Azure Functions, or AWS Lambdas.
Key Concepts
Service
A service represents a single backend operation and follows a Request/Response pattern.
Request
Requests are derived from CoreRequestBase
. Example:
public class CheckoutRequest : CoreRequestBase
{
public int CustomerId { get; set; }
public string CustomerName { get; set; }
public string IdentificationNumber { get; set; }
public CreditCard? CreditCard { get; set; }
public Product[] Items{ get; set; }
}
Response
Responses are derived from CoreResponseBase and contain a Succeeded property to indicate success. Example:
public class CheckoutResponse : CoreResponseBase
{
public long OrderId { get; set; }
}
Service Implementation
Services inherit from CoreServiceBase<TRequest,TResponse>
, where TRequest and TResponse are your custom request and response types. The core logic is implemented in the RunAsync() method.
Example:
public class CheckoutService : CoreServiceBase<CheckoutRequest, CheckoutResponse>
{
protected override async Task<CheckoutResponse> RunAsync()
{
// Implementation logic here...
var order = await CreateOrderAsync(this.Request.CustomerId, this.Request.Items);
return new CheckoutResponse { Succeeded = true, OrderId = order.Id };
}
}
Error Handling
Responses include a ReasonCode for error scenarios. ReasonCode is an enum with descriptive annotations. Example:
enum EcommerceReasonCode
{
[Description("Product is not available at this time")]
NoItemsAvailable = 10448
}
public class CheckoutService : CoreServiceBase<CheckoutRequest, CheckoutResponse>
{
protected override async Task<CheckoutResponse> RunAsync()
{
if (!CheckForAvailability(this.Request.Products))
{
return new CheckoutResponse
{
Succeeded = false,
ReasonCode = EcommerceReasonCode.NoItemsAvailable
};
}
// Implementation logic here...
}
}
Product | Versions 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. |
-
net6.0
- FluentValidation (>= 10.4.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on BaseLib.Core:
Package | Downloads |
---|---|
FacturaE.Sdk
Package Description |
|
BaseLib.Core.AmazonCloud
Package Description |
|
BaseLib.Core.MySql
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.0.4 | 633 | 5/22/2024 |
2.1.0.3 | 150 | 5/15/2024 |
2.1.0.2 | 683 | 1/16/2024 |
2.1.0.1 | 145 | 12/30/2023 |
2.1.0 | 460 | 12/28/2023 |
2.0.2 | 1,039 | 11/22/2023 |
2.0.1 | 237 | 11/21/2023 |
2.0.0 | 296 | 11/1/2023 |
1.1.0 | 176 | 10/16/2023 |
1.1.0-beta-004 | 3,327 | 11/22/2022 |
1.1.0-beta-003 | 490 | 11/16/2022 |
1.1.0-beta-002 | 212 | 11/15/2022 |
1.1.0-beta-001 | 178 | 11/3/2022 |
1.0.1 | 659 | 10/4/2022 |
1.0.0 | 728 | 10/3/2022 |
1.0.0-alpha-3 | 314 | 9/12/2022 |
1.0.0-alpha-2 | 387 | 8/22/2022 |
1.0.0-alpha-1 | 294 | 4/14/2022 |
1.0.0-alpha | 201 | 3/31/2022 |