Welcome to EMC Consulting Blogs Sign in | Join | Help

Michael Ciba's Blog

Enabling notifications for SqlCacheDependency using a database project

Ok so if you are using a database project and you want to turn on notifications for the database once it is deployed so you can use handy things like "SqlCacheDependency" a good way I found was to add a “AfterDeploy” target to the “*.dbproj” file for the database project and then just call “aspnet_regsql”. This way you don’t have to remember to run the command each time you deploy the database from scratch and I think it’s cleaner than having explicit try/catch logic within your application to setup the notifications.

<Target Name="AfterDeploy">
    <Exec Command="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -d FakeDataBaseName -ed -S . -E" ContinueOnError="true" />
    <Exec Command="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -d FakeDataBaseName -S . -E -et -t FakeDataBaseTable" ContinueOnError="true" />
</Target> 

 

 

Published 18 August 2009 13:08 by Michael.Ciba

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems