.daConnection Files
From RemObjects Software
This is a RemObjects SDK Glossary entry
Feel free to add your notes to this topic below.
Previous versions of Data Abstract for Delphi used to store connection definitions in the main executable as embedded resources that were very hard to replace and prevent shipping with your application. While this didn't pose any security threat and was mostly due to how form component streaming works in Delphi, it wasn't optimal.
New version of Data Abstract greatly improves how connection definitions are stored and loaded, and it gives you options to load them from files or embedded resources without requiring any specific coding.
When you create a new Data Abstract for .NET server, a .daConnections file is created and its properties are set so that it’s copied in the directory of the executable, whenever that is built. When you edit your schemas and modify the connection list, the .daConnections file gets modified.
Loading Connections
If you look at the code of the main form of a Data Abstract server again, you will see the following line of code:
connectionManager.Load();
Similarly to the .daConfig file, this line of code tries to load a .daConnection file from two different locations:
- as a <ApplicationName>.daConnnections file next to your application's executable
- as a <ApplicationName>.daConnnections resource in your application's executable
This means that a local file is found next to the executable, it will be loaded first; but if you chose to include a .daConnections resource in your application, your server will work without an external file and use the embedded default connections.
If you want to embed your .daConnections file into your executable, simply click on the .daConnections file in the Solution Explorer and change the property “Build Action” from “None” to “Embedded Resource” in the Properties pane.
Like the Configuration Class, the ConnectionManager Class also defines a set of Load methods that allow you to load the specific connection file from XML, files or resources.
Structure
The structure of a .daConnections file has been reworked and streamlined since version 3.0, removing any Delphi specific names and class types.
These are the contents of the MegaDemoServer.daConnections file included in the Mega Demo sample directory:
<Connections> <PoolingEnabled>True</PoolingEnabled> <PoolingBehavior>Wait</PoolingBehavior> <MaxPoolSize>10</MaxPoolSize> <WaitIntervalSeconds>0</WaitIntervalSeconds> <PoolTimeoutSeconds>0</PoolTimeoutSeconds> <Definitions> <Definition> <Name>Northwind</Name> <ConnectionString>MSSQL.NET?Database=Northwind;… <Default>True</Default> <Description>…</Description> </Definition> <Definition> <Name>Employees</Name> <ConnectionString>FB.NET?Server=localhost;Database=C:\Program Files… <Default>False</Default> <Description>…</Description> </Definition> </Definitions> </Connections>
Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)
Lists — Glossary — Features — How To — Drivers — Components — Tools — Samples — Articles — Architecture — Issues
Categories: Text | Data Abstract | Glossary | .NET
