Table of Contents

Class MsSqlService

Namespace
SunamoMsSqlServer.Services
Assembly
SunamoMsSqlServer.dll

Core service for managing MS SQL Server connections and executing database operations.

public class MsSqlService
Inheritance
MsSqlService
Inherited Members
Extension Methods

Constructors

MsSqlService(DbContext, ILogger)

Core service for managing MS SQL Server connections and executing database operations.

public MsSqlService(DbContext dbContext, ILogger logger)

Parameters

dbContext DbContext

The Entity Framework DbContext for database access.

logger ILogger

The logger instance for error reporting.

Methods

DeleteAll(string)

Deletes all rows from the specified table.

public Task DeleteAll(string tableName)

Parameters

tableName string

The name of the table to delete all rows from.

Returns

Task

A task representing the asynchronous operation.

GetAndOpenConnection()

Retrieves and opens the underlying SQL Server connection from the DbContext.

public Task<ResultWithExceptionMsSqlServer<SqlConnection>> GetAndOpenConnection()

Returns

Task<ResultWithExceptionMsSqlServer<SqlConnection>>

A result containing the opened SqlConnection or an exception message.