GlobalShared.CommonUtils.Library
4.0.8
dotnet add package GlobalShared.CommonUtils.Library --version 4.0.8
NuGet\Install-Package GlobalShared.CommonUtils.Library -Version 4.0.8
<PackageReference Include="GlobalShared.CommonUtils.Library" Version="4.0.8" />
paket add GlobalShared.CommonUtils.Library --version 4.0.8
#r "nuget: GlobalShared.CommonUtils.Library, 4.0.8"
// Install GlobalShared.CommonUtils.Library as a Cake Addin #addin nuget:?package=GlobalShared.CommonUtils.Library&version=4.0.8 // Install GlobalShared.CommonUtils.Library as a Cake Tool #tool nuget:?package=GlobalShared.CommonUtils.Library&version=4.0.8
Utils Class :- The Utils class is a helper utility that provides commonly used functions for various operations, including string manipulation, data type conversion, configuration retrieval, encryption, and response mapping. It offers methods for quoting strings and dates, checking for null or blank values, and converting strings to different data types such as integers, booleans, dates, decimals, floats, and longs with default values. Additionally, it retrieves application settings from appsettings.json and the configuration manager, ensures security through SHA-256 hashing,and formats data, such as currency values and date conversions. The class also standardizes response handling by creating structured response objects with status, descriptions, and error messages.
RestExtension Class:- The RestExtension class is a static utility that extends HttpClient, providing various asynchronous methods for making HTTP requests such as GET, POST, and PATCH. It simplifies API calls by handling request creation, adding headers dynamically, and managing response deserialization. Each method includes a cancellation token to prevent long-running requests from blocking execution. Error handling is built-in, returning a standardized ApiResponse object with status codes and messages. The class supports different response formats, including JSON objects, lists, and binary data (e.g., PDFs).Potential improvements include using strongly typed models for deserialization, better exception logging, and optimized header management with AuthenticationHeaderValue.
Logs Class:- The Logs class is a utility for logging different types of events, such as security incidents (SIEMLogs), exceptions (ExceptionLogs), and API requests (APIRequestLogs). Each method dynamically creates a log file based on the method name and date, ensuring the necessary directories exist before writing logs. It also sets access permissions for the log files and records log entries with timestamps in a structured format. This class helps in monitoring, debugging, and auditing application activity by maintaining detailed logs.
DataServiceUtils Class :- The DataServiceUtils class provides asynchronous utility methods for executing SQL queries using SqlConnection and SqlCommand. It includes two variations of the GetScalarAsync method, which retrieve a single value from the database�one with SQL parameters and one without. Similarly, the ExecuteNonQueryAsync method is available in two versions: one for executing non-query SQL statements such as INSERT, UPDATE, and DELETE without parameters and another that supports SQL parameters. The class ensures proper usage of using statements to manage SqlCommand resources efficiently. Additionally, exception handling uses throw; instead of throw ex; to preserve the original stack trace. However, setting sqlCommand.CommandTimeout = 0; may cause indefinite waits, and it is advisable to define a reasonable timeout to avoid performance issues.
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. |
-
net8.0
- AutoWrapper.Core (>= 4.5.1)
- Microsoft.Bcl.AsyncInterfaces (>= 9.0.1)
- Microsoft.Extensions.Configuration (>= 9.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.1)
- Microsoft.Extensions.Configuration.FileExtensions (>= 9.0.1)
- Microsoft.Extensions.Configuration.Json (>= 9.0.1)
- Microsoft.Extensions.FileProviders.Abstractions (>= 9.0.1)
- Microsoft.Extensions.FileProviders.Physical (>= 9.0.1)
- Microsoft.Extensions.FileSystemGlobbing (>= 9.0.1)
- Microsoft.Extensions.Primitives (>= 9.0.1)
- Newtonsoft.Json (>= 13.0.3)
- System.Buffers (>= 4.5.1)
- System.Configuration.ConfigurationManager (>= 7.0.0)
- System.Data.SqlClient (>= 4.8.6)
- System.Memory (>= 4.5.5)
- System.Numerics.Vectors (>= 4.5.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
- System.Text.Encodings.Web (>= 9.0.1)
- System.Text.Json (>= 9.0.1)
- System.Threading.Tasks.Extensions (>= 4.5.4)
- System.ValueTuple (>= 4.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.