Connecting to a Data Store
- 2 minutes to read
The ExpressEntityMapping Framework interacts with supported data stores using session components. Each component requires either a FireDAC or ADO connection object configured to access a specific data store, and a corresponding data provider component used as a session/connection mediator. Data provider components shipped with the ExpressEntityMapping Framework include:
A FireDAC-based data provider (TdxEMFFireDACDataProvider). This data provider is designed to link to a TFDConnection or TADConnection object.
An ADO-based data provider (TdxEMFADODataProvider). This data provider is designed to link to a TADOConnection object.
Follow the steps below to connect a session component (TdxEMFSession) to a data store using a FireDAC or ADO connection object:
Select an existing connection object (TFDConnection, TADOConnection, or TADConnection) or add a new connection object and specify its connection settings for the data store;
Depending on the connection object, add either the TdxEMFFireDACDataProvider or TdxEMFADODataProvider component;
Link this data provider component to the connection object using the component’s Connection property (TdxEMFFireDACDataProvider.Connection or TdxEMFADODataProvider.Connection);
Link the session and data provider components using the session component’s DataProvider property;
Select a target database engine using the data provider component’s Options.DBEngine property.
After that, the session component is ready to manage and query data store objects at runtime. You don’t need to open the connection object – the session component does this automatically.