Class MSSqlLocalDBApi
- Namespace
- DevExpress.Xpo.DB.Helpers
- Assembly
- DevExpress.Xpo.v24.1.dll
Provides helper methods allowing you to manage the SQL Server Express LocalDB instances.
public class MSSqlLocalDBApi : IDisposable
- Inheritance
-
MSSqlLocalDBApi
- Implements
- Inherited Members
Constructors
MSSqlLocalDBApi()
Initializes a new instance of the MSSqlLocalDBApi class.
public MSSqlLocalDBApi()
MSSqlLocalDBApi(string)
Initializes a new instance of the MSSqlLocalDBApi class with the specified LocalDBInstance.dll file location.
public MSSqlLocalDBApi(string fileName)
Parameters
fileName
stringA string path to the LocalDBInstance.dll file to load.
Fields
LOCALDB_MAX_SQLCONNECTION_BUFFER_SIZE
Gets the buffer size to store a LocalDB connection string (260, by default).
public const int LOCALDB_MAX_SQLCONNECTION_BUFFER_SIZE = 260
Field Value
MAX_LOCALDB_INSTANCE_NAME_LENGTH
Gets the maximum LocalDB instance name length (43, by default).
public const int MAX_LOCALDB_INSTANCE_NAME_LENGTH = 128
Field Value
MAX_LOCALDB_VERSION_LENGTH
Gets the maximum length of the LocalDB version (43, by default).
public const int MAX_LOCALDB_VERSION_LENGTH = 43
Field Value
MAX_STRING_SID_LENGTH
Gets the maximum length of the security identifier (186, by default).
public const int MAX_STRING_SID_LENGTH = 186
Field Value
Methods
CheckHandler()
Throws an ObjectDisposedException if the LocalDBInstance.dll handle is IntPtr.Zero.
public void CheckHandler()
CreateInstance(string, string)
Creates a new SQL Server Express LocalDB instance.
public void CreateInstance(string versionName, string instanceName)
Parameters
versionName
stringThe LocalDB version, for example 11.0 or 11.0.1094.2.
instanceName
stringThe name for the LocalDB instance to create.
DeleteInstance(string)
Deletes the specified LocalDB instance.
public void DeleteInstance(string instanceName)
Parameters
instanceName
stringA string name of the LocalDB instance to be deleted.
Dispose()
Disposes the MSSqlLocalDBApi instance.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
~MSSqlLocalDBApi()
protected ~MSSqlLocalDBApi()
GetInstanceInfo(string)
Returns information for the specified SQL Server Express LocalDB instance.
public MSSqlLocalDBInstanceInfo GetInstanceInfo(string instanceName)
Parameters
instanceName
stringA string that is the instance name.
Returns
- MSSqlLocalDBInstanceInfo
An MSSqlLocalDBInstanceInfo object that contains information on the specified LocalDB instance, e.g., whether it exists, the LocalDB version it uses, whether it is running, etc.
GetInstances()
Returns the names of all SQL Server Express LocalDB instances.
public string[] GetInstances()
Returns
- string[]
A string array that contains the names of both named and default LocalDB instances on the user’s workstation.
GetVersionInfo(string)
Returns information for the specified SQL Server Express LocalDB version.
public MSSqlLocalDBVersionInfo GetVersionInfo(string versionName)
Parameters
versionName
stringThe LocalDB version name.
Returns
- MSSqlLocalDBVersionInfo
An MSSqlLocalDBVersionInfo object that specifies whether the SQL Server Express LocalDB version exists and provides the full LocalDB version number (including build and release numbers).
GetVersions()
Returns all SQL Server Express LocalDB versions installed.
public string[] GetVersions()
Returns
- string[]
A string array that contains the names of the installed LocalDB versions.
ShareInstance(SecurityIdentifier, string, string)
Shares the specified SQL Server Express LocalDB instance with other users with the specified shared name.
public void ShareInstance(SecurityIdentifier sid, string instancePrivateName, string instanceSharedName)
Parameters
sid
SecurityIdentifierA System.Security.Principal.Security object which is the security identifier (SID) of the instance owner.
instancePrivateName
stringA string that is the private name for the LocalDB instance to be shared.
instanceSharedName
stringA string that is the shared name for the LocalDB instance to be shared.
StartInstance(string, out string)
Starts the specified SQL Server Express LocalDB instance.
public void StartInstance(string instanceName, out string connectionString)
Parameters
instanceName
stringA string that is the name of the LocalDB instance to be started.
connectionString
stringA string that is the connection string to the LocalDB instance.
StartTracing()
Starts tracing API calls for all the SQL Server Express LocalDB instances that belong to the current system user.
public void StartTracing()
StopInstance(string, MSSqlLocalDBShutdownFlags, long)
Stops the specified SQL Server Express LocalDB instance from running.
public void StopInstance(string instanceName, MSSqlLocalDBShutdownFlags shutdownFlags, long timeout)
Parameters
instanceName
stringThe string name of the LocalDB instance to be stopped.
shutdownFlags
MSSqlLocalDBShutdownFlagsAn MSSqlLocalDBShutdownFlags enumeration value that specifies the way to stop the instance.
timeout
longAn integer number that is the number of seconds to wait for the stop operation to complete. If set to 0, the method returns immediately without waiting for the LocalDB instance to stop.
StopTracing()
Stops tracing API calls for all the SQL Server Express LocalDB instances that belong to the current system user.
public void StopTracing()
UnshareInstance(string)
Stops the sharing of the specified SQL Server Express LocalDB instance.
public void UnshareInstance(string instanceSharedName)
Parameters
instanceSharedName
stringA string that is the shared name of the LocalDB instance that will no longer be shared.