DbBaseClass 1.0.1
dotnet add package DbBaseClass --version 1.0.1
NuGet\Install-Package DbBaseClass -Version 1.0.1
<PackageReference Include="DbBaseClass" Version="1.0.1" />
<PackageVersion Include="DbBaseClass" Version="1.0.1" />
<PackageReference Include="DbBaseClass" />
paket add DbBaseClass --version 1.0.1
#r "nuget: DbBaseClass, 1.0.1"
#:package DbBaseClass@1.0.1
#addin nuget:?package=DbBaseClass&version=1.0.1
#tool nuget:?package=DbBaseClass&version=1.0.1
DataBase Base Class
Overview
base class for any database project, managing all Sql Server repository patterns operations along with Redis for Caching
Usage Examples
for Caching
public List<ClassName> GetAll() { string cacheKey = $"Key"; return _cacheHelper.GetOrSetListCache(cacheKey, () ⇒ { return GetAll(); }, TimeSpan.FromMinutes(1000)); }
Installation
To install your package, use the following command:
bash
dotnet add package DatabaseBaseClass
ServiceCollectionExtensions
The ServiceCollectionExtensions class provides an extension method to configure and add Redis caching functionality and the RedisCacheHelper to the IServiceCollection. This is designed to be used in ASP.NET Core applications for integrating Redis as a caching solution.
Method: AddBaseetaBaseClass
This method adds a Redis connection and helper to the application's dependency injection container.
Parameters
IServiceCollection services: The service collection to which the services will be added.IConfiguration configuration: The configuration object to retrieve Redis connection details.string redisConnectionString: (Optional) The key used to locate the Redis connection string in the configuration. Default is"RedisServerConnection".
Prerequisites
To use this method, add the Redis server configuration to your appsettings.json file under the Redis section.
Example appsettings.json
{
"Redis": {
"Server": "localhost",
"Port": "6379",
"Password": "your_redis_password"
}
}
Optional fields
Password: Password field is optional. User can leave it empty string or not declare it. If it is empty or null then passowrd will not be passed to redis connection.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 403 | 1/26/2025 |