[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Collapse]eXpress Persistent Objects
 [Expand]Product Information
 [Expand]Getting Started
 [Expand]Fundamentals
 [Expand]Feature Center
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Examples
 [Expand]Member Tables
 [Collapse]API Reference
  [Expand]DevExpress.Xpo
  [Collapse]DevExpress.Xpo.DB
   [Expand]AccessConnectionProvider Class
   [Expand]AccessConnectionProviderMultiUserThreadSafe Class
   [Expand]CachedDataStoreClient Class
   [Expand]CachedDataStoreClientAsync Class
   [Expand]CachedDataStoreClientAsyncBase<TContractType> Class
   [Expand]CachedDataStoreService Class
   [Expand]DataStoreClient Class
   [Expand]DataStoreClientAsync Class
   [Expand]DataStoreService Class
   [Expand]FirebirdConnectionProvider Class
   [Expand]ICachedDataStoreService Interface
   [Expand]ICachedDataStoreServiceAsync Interface
   [Expand]ICachedDataStoreWarpService Interface
   [Expand]ICachedDataStoreWarpServiceAsync Interface
   [Expand]IDataStoreService Interface
   [Expand]IDataStoreServiceAsync Interface
   [Expand]IDataStoreWarpService Interface
   [Expand]IDataStoreWarpServiceAsync Interface
   [Expand]InMemoryDataStore Class
   [Expand]ISerializableObjectLayerService Interface
   [Collapse]MSSqlConnectionProvider Class
     MSSqlConnectionProvider Members
     MSSqlConnectionProvider Constructor
    [Expand]MSSqlConnectionProvider Properties
    [Expand]MSSqlConnectionProvider Methods
   [Expand]OleDBConnectionProvider Class
   [Expand]OperationResult Class
   [Expand]OperationResult<T> Class
   [Expand]PostgreSqlConnectionProvider Class
   [Expand]SerializableObjectLayerProxyBase Class
   [Expand]SerializableObjectLayerService Class
   [Expand]SerializableObjectLayerServiceClient Class
   [Expand]ServiceBase Class
   [Expand]ServiceExceptionEventArgs Class
  [Expand]DevExpress.Xpo.DB.Helpers
  [Expand]DevExpress.Xpo.Exceptions
  [Expand]DevExpress.Xpo.Helpers
  [Expand]DevExpress.Xpo.Metadata
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

MSSqlConnectionProvider Class

Implements data-aware operations for working with an MS SQL Server or MS SQL Azure database.

Namespace:DevExpress.Xpo.DB
Assembly:DevExpress.Xpo.v19.1.dll

Expanded Syntax

Expanded Remarks

The MSSqlConnectionProvider class implements data-aware operations for working with MS 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 MS SQL database, you can generate a connection string via the static 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:

  • When sharing a single IDataLayer object between multiple sessions, a connection provider should be passed to the data layer's constructor. See the IDataLayer topic for additional information.
  • When manually maintaining a connection pool.

Expanded Example

The following code demonstrates how to connect to an MS SQL database. The 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.

Expanded Inheritance Hierarchy

System.Object
    System.MarshalByRefObject
       DevExpress.Xpo.DB.DataStoreSerializedBase
          DataStoreBase
             ConnectionProviderSql
                MSSqlConnectionProvider

Expanded See Also

Is this topic helpful?​​​​​​​