DatabaseBaseClass 1.0.5

dotnet add package DatabaseBaseClass --version 1.0.5                
NuGet\Install-Package DatabaseBaseClass -Version 1.0.5                
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="DatabaseBaseClass" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DatabaseBaseClass --version 1.0.5                
#r "nuget: DatabaseBaseClass, 1.0.5"                
#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 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.5 89 1/7/2025
1.0.4 118 1/5/2025
1.0.3 137 1/1/2025
1.0.2 72 1/1/2025
1.0.1 72 1/1/2025
1.0.0 65 1/1/2025