Useful code samples for the DacFx and SSDT public APIs.
This project provides code samples for the DacFx and SSDT public APIs. This includes sample deployment contributors, sample static code analysis rules, and examples of how to use the public model to examine the contents of a Data-tier Application (.dacpac) file, among other things. There is a tutorial
that makes use of this sample code and explains in greater depth what each sample does.Background Information
SQL Server Data Tools (SSDT) is built into Visual Studio 2013. For other versions of visual studio you can download SSDT from here: SSDT Website
. SSDT provides an integrated environment for database developers to carry out all of their database design work for any SQL Server Platform.
DacFx is the core technology the SSDT leverages for incremental database deployments, modelling and validation of database schemas and other key functionality. DacFx provides a DacServices API that supports programmatic deployment of Dacpac files. It now has a number of public extensibility points that customers can implement. Some possible functionality includes:
- Programmatic examinations of database schemas (as represented in a Visual Studio database project, a Dacpac and even a target database when used during deployment)
- Modification of the deployment plan that is used to incrementally deploy schema updates from a Dacpac to a database
- Static Code Analysis rules provide build-time support for analyzing the database schema and warning users of potential issues.
These samples are primarily intended to show users how to create their own extensions, test them and use them in deployment. They include solutions to real customer problems and can be used as-is if you have the same issue. Ideally you will take this project, extend it and create your own solutions.Prerequisites
An installation of SSDT or DacFx is required to run these samples. The sample projects include references to DLLs in a Visual Studio installation with the March 2014 release of SSDT.
- For Visual Studio 2013 the install directory will is "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120". This is set as the current hint path in all sample projects
- For Visual Studio 2012 the install directory is "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\120". The hint path in all sample projects must be updated if you want to target Visual Studio 2012 DLLs.
This project uses Git for source code control. Visual Studio 2013 has Git support built in, and for Visual Studio 2012 please download the Visual Studio Tools for Git
The samples in this project are provided as-is. To run the samples, we recommend you download the source code and attach a debugger while running the sample console application and unit test code.
The full tutorial explaining how to use the public APIs can be found at http://blogs.msdn.com/b/ssdt/archive/2013/12/23/dacfx-public-model-tutorial.aspx