The DataContext is the main controller that retrieves objects from the database and resubmits changes. You can use it in the same way that you would use an ADO.NET connection (the DataContext is initialized with a connection or connection string). The purpose of the DataContext is to translate your requests for objects into SQL queries made against the database and then assemble objects out of the results. The DataContext enables language-integrated query by implementing the same operator pattern as the standard query operators such as WHERE and SELECT.
For example, let's define a DataContext class, which works with data from the CRM_DEMO database. We have defined three constructors for the DataContext initialization. First one initializes DataContext with an IDbConnection interface. Second one need an explicit definition of the connection string. Third is the default one who doesn't need any explicit declarations, we've initialized a connection string of the base class; Also we've defined a constructor that uses an IDBInterface instance for the DataContext creating. Also, in the given examples we have created the collections of the "Company" and "Order" entities. They are presented by the two instances of the Table<TEntity>.
Note that the Devart.Data.Linq.DataContext class can use different data providers to connect to different DBMSs. Thus, when a DataContext instance is created, it should know what data provider to use. You can specify this data provider, e.g., by setting the ProviderAttribute class attribute for SystemDataContext. In the attribute, replace Devart.Data.Oracle.Linq.Provider.OracleDataProvider by the provider you actually use:
Use the following code if you want to get the database connection string from the configuration file.
If you are developing web project, use the WebConfigurationManager class instead of the ConfigurationManager.