xpo-devexpress-dot-xpo-dot-db-9d4b4108.md
Implements data-aware operations for working with an Microsoft SQL Server or Microsoft SQL Azure database.
Namespace : DevExpress.Xpo.DB
Assembly : DevExpress.Xpo.v25.2.dll
NuGet Package : DevExpress.Xpo
public class MSSqlConnectionProvider :
ConnectionProviderSql
Public Class MSSqlConnectionProvider
Inherits ConnectionProviderSql
The MSSqlConnectionProvider class implements data-aware operations for working with Microsoft SQL databases. In most cases, there is no need to create connection providers explicitly, as they are created automatically by a Session object based upon a connection string.
To connect to a specific Microsoft SQL database, you can generate a connection string via the static MSSqlConnectionProvider.GetConnectionString method. This connection string will contain information on the provider ( MSSqlConnectionProvider ) that will be used to work with the database. Supply this connection string to a Session object (for instance, via the Session.ConnectionString or XpoDefault.ConnectionString property). When a connection to a database is to be established, the session will create a corresponding connection provider based upon the connection string and then perform all data-aware operations using this connection provider.
There are also cases when you need to create a connection provider explicitly via its constructor, for instance:
The following code demonstrates how to connect to an Microsoft SQL database. The MSSqlConnectionProvider.GetConnectionString method is called to construct a connection string to the database. It is then assigned to the default session via the Session.ConnectionString property.
using DevExpress.Xpo;
using DevExpress.Xpo.DB;
Session.DefaultSession.ConnectionString = MSSqlConnectionProvider.GetConnectionString(
"SERVER", "sa", "", "Northwind");
Imports DevExpress.Xpo
Imports DevExpress.Xpo.DB
Session.DefaultSession.ConnectionString = MSSqlConnectionProvider.GetConnectionString( _
"SERVER", "sa", "", "Northwind")
Object MarshalByRefObject DevExpress.Xpo.DB.DataStoreSerializedBase DataStoreBase ConnectionProviderSql MSSqlConnectionProvider
See Also
MSSqlConnectionProvider Members
AccessConnectionProviderMultiUserThreadSafe