DBRef is a database-based referencing framework for .Net assemblies that is injected as demanded by the CLR.
What this means is that you can deploy all your DLLS to the database and have it injected into the application at runtime.
This has great potential for application deployment and updates!
The framework is designed to be as simple as possible and consists of two parts;
* a console application that can be used to register assembly references, which also integrates into Visual Studio projects as a post-build event
* a dll (DBRef..dll), which is referenced by the primary application and it provides dlls from the database, as needed.
Developed by: Shailen Sukul
- Microsoft .Net Framework 3.5
- Sql Server 2005
- Visual Studio 2008 (to edit source code)
The database design consists of 3 tables:
- Application - contains information about your application
- Assembly - contains a serialized copy of assembly files (dlls)
- Manifest - links the assemblies to an application for a particular release
Copy the DBref.dll and DBrefCommand.exe files to the bin/(Debug or Release) folder of your project (see the releases section)
In app.config of your main project, specify the assembly the manifest as follow:
// Place this in the header section
<section name="DBRefSection" type="DBRef.Configuration.DBRefSection, DBRef, Version=18.104.22.168,
Culture=neutral, PublicKeyToken=null" allowLocation="true" allowDefinition="Everywhere" />
// Add a DBRef section
<DBRefSection ApplicationName="TestApplication" ReleaseVersion="22.214.171.124" DatabaseConnection="DBRefDB">
<Assembly Name="SampleAssembly" Filepath="..\..\Reference\SampleAssembly.dll"
Description="Sample Assembly 1" />
<Assembly Name="SampleAssembly2" Filepath="..\..\Reference\SampleAssembly2.dll"
Description="Sample Assembly 2" /> </Assemblies>
// provide a database connection string
<connectionstrings> <add name="DBRefDB"
Run the Database.sql
file to create the tables in your target database. Alternatively, simply run the post-build event below and the configured database will get created automatically (assuming you have database creation rights).
Add a post-build step to your project to copy the assemblies to the database.
Add one line of code to the program.cs file of your application to intialize DBRef.
DBRef.Utility util = new DBRef.Utility();
Now you can delete all your referenced dlls from the bin folder and it should load from the database when the application executes.
Enjoy and please update the discussions section with your feedback!