NetUtilityKit 1.0.1
dotnet add package NetUtilityKit --version 1.0.1
NuGet\Install-Package NetUtilityKit -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetUtilityKit" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetUtilityKit --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NetUtilityKit, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetUtilityKit as a Cake Addin #addin nuget:?package=NetUtilityKit&version=1.0.1 // Install NetUtilityKit as a Cake Tool #tool nuget:?package=NetUtilityKit&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NetUtilityKit.LibraryNuget
It allows you to develop your projects quickly. It contains many supporting structures. Contact us if you want to support.
Install
dotnet add package NetUtilityKit --version 1.0.1
Package Included
ResponseModel:
It ensures that the controller is clean and legible.
It allows you to give a stronger and different response. Different Overloads are available.
There is no need to do if else in the controller. You can manage this situation from a different layer.
If you don't want to repeat yourself, you can manage the controller part with a base class.
A simple example is presented.
ExpressionParser:
Converting the filtering expression you receive as a string by the client to the expression type.
In this way, you can quickly perform powerful filtering operations with a single method.
You may need to set limits on filters for security.
Use ResponseModel
Example- Service
public async Task<ResponseModel<bool>> CreateItemAsync(CreateItemDto createItemDto, CancellationToken cancellationToken)
{
try
{
await AddItemAsync(createItemDto, cancellationToken);
return ResponseModel<bool>.SuccessResponse(true, 201);
}
catch (Exception ex)
{
_logger.LogError(ex.Message);
return ResponseModel<bool>.ErrorResponse($"{ex.Message}", 500);
}
}
Example- Controller
[HttpPost]
public async Task<IActionResult> Create(CreateItemDto createItemDto, CancellationToken cancellationToken)
{
var response = await _itemService.CreateItemAsync(createItemDto, cancellationToken);
return new ObjectResult(response)
{
StatusCode = response.StatusCode
};
}
Use ExpressionParser
Example - Request Query And Body
public sealed record GetAllFilterCustomerQuery(
string Expression
);
Example- Service
public async Task<List<Customer>> GetAllFilter(GetAllFilterCustomerQuery request)
{
var expression = ExpressionParser.ParseExpression<Customer>(request.Expression);
var query = _queryRepository.GetAll().Where(expression).Include(p => p.CustomerType).ToListAsync();
return result;
}
Example - Request
{
"expression": "x=> x.IsActive == true"
}
By Abdullah Balikci - berjcode
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- System.Linq.Dynamic.Core (>= 1.3.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
In this version, the responsemodel feature has been added.