It possible to integrate the db4o enhancements into the build process, using a special MSBuild-Task.
The enhance-functionality resides in the Db4oTool.exe, Db4oTool.MSBuild.dll and its dependencies. All these files are in the db4o-distribution. Ensure that all dll-files are in the same directory. Then ensure that the build-script has configured the right location for the Db4oTool.exe etc. For this example in the Db4oTool and dependencies are in the 'lib'-folder of the project
First we define the enhancement-task. This task will process the assembly and enhance it.
You can add this to the existing project-files. The .csproj or .vbproj are actually MSBuild-files. Open them with a XML-Editor and add the needed parts.
<UsingTask AssemblyFile=".\lib\Db4oTool.MSBuild.dll" TaskName="Db4oTool.MSBuild.Db4oEnhancerMSBuildTask" /> <ItemGroup> <Db4oEnhance Include="$(TargetPath)" /> </ItemGroup>
And the execute the task after the compilation.
<Target Name="AfterBuild"> <Db4oEnhancerMSBuildTask Assemblies="@(Db4oEnhance)" /> </Target>
Now Visual Studio will automatically run the tasks for each build. You don't need to change anything else.
Often it's practical to have all persistent classes in a separate project or compile unit. Then the enhancement script runs only for this project. This makes it easy to enhance only the classes for the persistent objects.
There are lot of possibilities to tweak and configure the build-time enhancement so that it fits your requirements. See "Build Time Enhancement"