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
loggerILoggerThe logger instance for error reporting.
dbContextDbContextThe Entity Framework DbContext for database access.
Methods
GrantInsert(string)
Grants INSERT permission on the specified table.
public Task GrantInsert(string tableName)
Parameters
tableNamestringThe 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
tableNamestringThe name of the table to query.
columnNamestringThe 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
tableNamestringThe name of the table to revoke INSERT permission from.
Returns
- Task
A task representing the asynchronous operation.