What's New in NDO 3.0
Note that NDO is now available in version 4.0. This text is only important for people who still use NDO 2.1 today.
In the past, we had some versioning issues with NDO that we fixed with NDO 3.0. To solve these problems, a few changes were needed that would prevent old projects from compiling. Here we describe the nature of the problems and how you can get NDO 2.1 applications to compile again with NDO 3.0.
Versioning issues with NDO 2.1 and earlier
NDO used to be a Visual Studio add-in. The add-in was a dll that was in the NDO installation directory but was loaded into Visual Studio's AppDomain. This means that the add-in could not use private dlls. However, because the add-in required the NDO dlls, the NDO dlls were installed in the GAC. These Dlls in the GAC were loaded by the following applications:
- The NDO Add-in
- The NDO Enhancer during the build
- The application developed with the help of NDO
If a minor change was made to NDO, it was not enough to set the version number of NDO to 188.8.131.520, for example. It would have been necessary to completely uninstall NDO and install a new version. However, this might have forced older projects to update to the newest NDO version.
We wanted to solve this problem. In addition, another problem arose, namely that Visual Studio add-ins will no longer be supported as of the 2015 release. We had to rewrite the add-in as a Visual Studio extension package (VSIX).
The NDO Build Task
For the enhancer, a build task has been available since mid-2013. This build task and its targets file (NDOEnhancer.Targets) were in the NDO installation directory. The directory was stored into the registry during installation. The project file (.csproj) was modified when NDO was activated so that the NDO installation directory was read as a property from the registry and included as a target using the NDOEnhancer property. To do this, the following lines have been inserted into the projects:
<NDOEnhancer NdoProjectFile="$(ProjectName).ndoproj" NdoPlatformTarget="$(Platform)" />
<NDOInstallPath Condition=" '$(NDOInstallPath)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\NDO@InstallDir)</NDOInstallPath>
<Import Project="$(NDOInstallPath)\NDOEnhancer.Targets" />
NDO as Visual Studio Extension (vsix)
Because Visual Studio add-ins are no longer supported as of version 2015, the add-in has been rewritten as an extension. This has advantages:
- An extension can use its own private dlls.
- Extensions work with the Community Edition of Visual Studio
We rewrote the Visual Studio Extension so that the dependencies on the NDO.dll were minimized. This means that the extension will work with an older NDO version in the long run. So it doesn't need the latest NDO.dll. Instead the extension brings her own private NDO.dll. Since NDO is no longer in the GAC, the extension can use a different NDO.dll as the application developed with NDO.
If a new application is configured with the NDO configuration dialog, the latest NDO.dll is installed by Nuget.
NDO via Nuget
You can use install-package to install NDO.dll NDO from Nuget.org. However, it is recommended that you install NDO using the NDO configuration dialog, because this will initialize the .ndoproj file correctly. The initialization can be customized using the user interface.
As soon as NDO is installed in an application, you can update NDO with
As soon as we make changes to NDO, a new tag is created in the repository and the modified Dll is uploaded to Nuget as a new version.
Update to NDO 3.0
If you have already installed NDO as a Visual Studio Package, we recommend uninstalling it via Tools / Extensions and Updates...
We also recommend the deinstallation of NDO 2.1.
Attention, if you really have to maintain NDO 2.1 applications
Copy the NDO installation directory to another location before you deinstall NDO 2.1.
You will need the following files:
- The Provider Folder, if you worked with databases other than Access and Sql Server
The AppDomain of the enhancer runs in the executable directory of your application. This directory must contain the NDO.dll and NDOInterfaces.dll if you want the enhancer to work.
Then restore the NDO registry entry:
Windows Registry Editor Version 5.00
"InstallDir"="C:\\Program Files (x86)\\NDO 2.1 Dev Edition\\"
As child of the Options tag in the .ndoproj-Datei there must be a tag like that:
We urgently recommend an Update to NDO 3.0 instead.
The Data Access Layer of NDO 3.0 is identical as that of NDO 2.1.
Remove the references to NDO.dll and NDOInterfaces.dll.
If NDO is included as a build target in your project file (in versions starting at approx. Mid 2013), then use an editor to remove the NDO target lines from the project (see "The NDO Build Task") and rename the .ndoproj file so that NDO can no longer find them. (Don't delete the file.) Then activate NDO with the new VS extension. You can delete the newly created .ndoproj file and reactivate the old file by renaming it. The new build target of NDO 3.0 should now be part of the .csproj file.
Make sure that the line
exists in the .ndoeproj file under <Options>.
Breaking Changes of NDO 3.0
The namespace NDO.Mapping has been revised. All enumerations are now implemented as IEnumerable<T>. The old APIs returned untyped ArrayList objects that you could index directly. The new APIs always return IEnumerable<T>.
The most common change that occurs during the 3.0 update is as follows:
Connection conn = (Connection) pm.NDOMapping.Connections;
you write now:
Connection conn = pm.NDOMapping.Connections.FirstOrDefault();
FirstOrDefault needs the Namespace System.Linq.
If you have not used the mapping API in your project, it is sufficient to recompile after the update.
The NDOEnhancer in Version 3.0
The enhancer depends on the NDO.dll in the respective version. Therefore, the enhancer always comes as part of the ndo.dll package. Nuget packages have a build directory where the enhancer is located along with the NDOEnhancer.Targets file. This file is included in the .csproj file. The NDOEnhancer target then calls the enhancer. In this way, each project has its isolated NDO environment.