protected override async Task ExecuteStatementAsync(StatementContext context) { var securityManager = context.GetService <IRoleManager>(); if (securityManager == null) { throw new SystemException("There is no security manager defined in the system"); } if (!await securityManager.RoleExistsAsync(RoleName)) { throw new SqlStatementException($"The role '{RoleName}' does not exist."); } if (!await securityManager.DropRoleAsync(RoleName)) { throw new SqlStatementException($"It was not possible to delete the role '{RoleName}' because of a system error"); } context.RaiseEvent(new RoleDroppedEvent(this, RoleName)); }