DatabaseBaseClass 1.0.5
dotnet add package DatabaseBaseClass --version 1.0.5
NuGet\Install-Package DatabaseBaseClass -Version 1.0.5
<PackageReference Include="DatabaseBaseClass" Version="1.0.5" />
paket add DatabaseBaseClass --version 1.0.5
#r "nuget: DatabaseBaseClass, 1.0.5"
// Install DatabaseBaseClass as a Cake Addin #addin nuget:?package=DatabaseBaseClass&version=1.0.5 // Install DatabaseBaseClass as a Cake Tool #tool nuget:?package=DatabaseBaseClass&version=1.0.5
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. |
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.