Table of Contents

Class UniqueIdService

Namespace
SunamoMsSqlServer.Services
Assembly
SunamoMsSqlServer.dll

Service for managing unique ID generation and identity insert permissions on MS SQL Server tables.

public class UniqueIdService
Inheritance
UniqueIdService
Inherited Members
Extension Methods

Constructors

UniqueIdService(ILogger, DbContext)

Service for managing unique ID generation and identity insert permissions on MS SQL Server tables.

public UniqueIdService(ILogger logger, DbContext dbContext)

Parameters

logger ILogger

The logger instance for error reporting.

dbContext DbContext

The Entity Framework DbContext for database access.

Methods

GrantInsert(string)

Grants INSERT permission on the specified table.

public Task GrantInsert(string tableName)

Parameters

tableName string

The name of the table to grant INSERT permission on.

Returns

Task

A task representing the asynchronous operation.

Int(string, string)

Returns the next unique integer ID for the specified table column by finding the current maximum and incrementing it.

public Task<ResultWithExceptionMsSqlServer<int>> Int(string tableName, string columnName)

Parameters

tableName string

The name of the table to query.

columnName string

The name of the column to find the maximum value in.

Returns

Task<ResultWithExceptionMsSqlServer<int>>

A result containing the next unique integer ID or an exception message.

RevokeInsert(string)

Revokes INSERT permission on the specified table.

public Task RevokeInsert(string tableName)

Parameters

tableName string

The name of the table to revoke INSERT permission from.

Returns

Task

A task representing the asynchronous operation.