This project is read-only.

Creating New Logs

One of the benefits of using Dot Net Migrations over using other database migrations strategies is how easy it is to extend Dot Net Migrations. Thanks to the Managed Extensibility Framework, Dot Net Migrations allows you to create additional commands and ways to log the application's information to fit your business needs.

When you create a custom log, a certain amount of guidance is provided in order to ensure a consistent pattern across each log's interface.
  • All logs provide methods for logging messages, errors, and warnings.
  • All logs inherently implement IDisposable and allows the Dispose method to be overriden by log creators.

In order to add custom log into Dot Net Migrations' command list, you need to do the following:
  1. Create a new class library project and reference the DotNetMigrations.Core.dll
  2. Create a new class that will represent the command's entrypoint and have it inherit from the DotNetMigrations.Core.LoggerBase abstract class.
  3. Fill in all methods and properties with the logic for your log.
  4. If your log requires resources to be disposed of after it's been used, override the Dispose method and place such cleanup code there.
  5. Compile to a DLL.
  6. Update PlugInDirectory the db.exe.config file to point to a directory you wish to hold all of your custom parts.
  7. If the PlugInDirectory was changed, update the probing runtime section of the configuration file to point to the same subdirectory.
  8. Update the DNM.Logs configuration section to include a reference to your log.
  9. Copy the DLL into the directory specified in step 6.

Once the DLL containing your log is in the Plug In directory and it's configured in the DNM.Logs configuration section, Dot Net Migrations will automatically pick it up and use it the next time it runs.

Coming Soon

Last edited Jan 27, 2010 at 4:03 AM by JamesEggers, version 2


No comments yet.