This unit test project is meant to demonstrate features of the Sql Management Objects framework and to help developers optimize performance of their SMO-based applications.
About this sample
Before you begin
Run this sample
Sample details
Disclaimers
Related links
- Applies to: SQL Server 2016 (or higher), Azure SQL Database, Azure SQL Data Warehouse
- Key features:
- Unit tests and a docker file that demonstrate proper use of SMO features against a working SQL Server instance.
- Programming Language:
- C#
To run this sample, you need the following prerequisites.
Software prerequisites:
- SQL Server 2016 (or higher) or an Azure SQL Database with the full WideWorldImporters sample database, or
- Docker
- At minimum the dotnet 2.2 SDK, or Visual Studio 2017
If using Docker, use runtests.sh or runtests.cmd as appropriate. If using a separate instance of SQL Server or Azure SQL Database, create a .runsettings file and run the unit tests using Visual Studio or "dotnet vstest".
Each unit test demonstrates a specific aspect of SMO-based application development, either in isolation or in conjunction with other SMO components.
Feature areas tested include:
- Efficient use of collections
- Sql query capture
- Events
- URNs
- Script generation
The SMO NuGet package is at https://www.nuget.org/packages/Microsoft.SqlServer.SqlManagementObjects/
Documentation for the APIs is at https://docs.microsoft.com/sql/relational-databases/server-management-objects-smo/overview-smo
The WideWorldImporters sample database can be found at https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/WideWorldImporters-Full.bak