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
dbContextDbContextThe Entity Framework DbContext for database access.
loggerILoggerThe logger instance for error reporting.
Methods
DeleteAll(string)
Deletes all rows from the specified table.
public Task DeleteAll(string tableName)
Parameters
tableNamestringThe 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.