SqlServerDbaServices
Provides DBA services for Microsoft SQL Server.
- Namespace:
- Inetdev.Data.SqlServer.Dba
- Type:
- Class
- Public:
- Yes
- Protected:
- No
- Sealed:
- Yes
- Abstract:
- No
- Inherits from:
- System.Object
Constructors
SqlServerDbaServices
Default constructor
- Signature:
public Void SqlServerDbaServices()
Properties
DataAccessAPI
Database communication API pointing to the "master" database.
- Signature:
public IDbAccess DataAccessAPI { get; set; }
Methods
ChangeLoginPasswordAsync
Changes the login password.
- Signature:
public Task ChangeLoginPasswordAsync(login)
Parameters
Exceptions
CreateDatabaseAsync
Creates a new database.
- Signature:
public Task CreateDatabaseAsync(name, collate, autoCloseOff, autoShrinkOff)
Parameters
Name |
Type |
Summary |
name |
String |
Name of the database. |
collate |
String |
Collation for the database (optional). |
autoCloseOff |
Boolean |
Whether to issue an AUTO_CLOSE OFF command. |
autoShrinkOff |
Boolean |
Whether to issue an AUTO_SHRINK OFF command. |
Exceptions
CreateLoginAsync
Creates a new login.
- Signature:
public Task CreateLoginAsync(login)
Parameters
Exceptions
CreateSchemaAsync
Creates a schema in the database.
- Signature:
public Task CreateSchemaAsync(name, database)
Parameters
Name |
Type |
Summary |
name |
String |
Name of the schema. |
database |
String |
Name of the database. |
Exceptions
CreateUserAsync
Creates a user for login in the database database
and adds the user to the specified roles.
- Signature:
public Task CreateUserAsync(userName, login, database, roles)
Parameters
Name |
Type |
Summary |
userName |
String |
Name of the user to add. |
login |
String |
Name of the login the user is added for. |
database |
String |
Name of the database to add the user to. |
roles |
UserRoles |
User roles to be granted to the new user. |
Exceptions
DropDatabaseAsync
Drops a database.
- Signature:
public Task DropDatabaseAsync(name)
Parameters
Name |
Type |
Summary |
name |
String |
Name of the database to drop. |
Exceptions
DropLoginAsync
Drops a login.
- Signature:
public Task DropLoginAsync(name)
Parameters
Name |
Type |
Summary |
name |
String |
Name of the login to drop. |
Exceptions
DropSchemaAsync
Drops a schema in the database.
- Signature:
public Task DropSchemaAsync(name, database)
Parameters
Name |
Type |
Summary |
name |
String |
Name of the schema. |
database |
String |
Name of the database. |
Exceptions
DropUserAsync
Drops a user named name from the database.
- Signature:
public Task DropUserAsync(name, database)
Parameters
Name |
Type |
Summary |
name |
String |
Name of the user to drop. |
database |
String |
Name of the database from where the user is dropped. |
Exceptions
ExistsDatabaseAsync
Checks whether a database exists on the server.
- Signature:
public Task<Boolean> ExistsDatabaseAsync(name)
Returns
true if the database exists, otherwise false.
Parameters
Name |
Type |
Summary |
name |
String |
Name of the database to check. |
Exceptions
ExistsLoginAsync
Checks whether a login exists.
- Signature:
public Task<Boolean> ExistsLoginAsync(name)
Returns
true if the login exists, otherwise false.
Parameters
Name |
Type |
Summary |
name |
String |
Name of the login to check. |
Exceptions
ExistsUserAsync
Checks whether a user exists within a database.
- Signature:
public Task<Boolean> ExistsUserAsync(userName, databaseName)
Returns
true if the user exists within the database, otherwise false.
Parameters
Name |
Type |
Summary |
userName |
String |
Name of the user to verify. |
databaseName |
String |
Name of the database to which the user belongs. |
Exceptions
GetServerRolesAsync
Gets the server roles for the spacified userName.
- Signature:
public Task<ServerRoles> GetServerRolesAsync(userName)
Returns
A flagged enumeration of the user server roles.
Parameters
Name |
Type |
Summary |
userName |
String |
Name of the user to get it's server roles. |
Exceptions