mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-18 17:23:52 -05:00
Update docs (#200)
This is a documentation-only update so automerging. Please review the commit if there are any follow-ups requested. * Update .gitignore for docfx genertated files * Update documenation (part 1) * Update docs and add some samples * More doc updates
This commit is contained in:
45
docs/samples/smo/net45/Scripting/Program.cs
Normal file
45
docs/samples/smo/net45/Scripting/Program.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
|
||||
namespace Microsoft.SqlServer.Management.SmoSdkSamples
|
||||
{
|
||||
// This application demonstrates how to script out a sample database without dependencies and iterate through the list to display the results.
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// Connect to the local, default instance of SQL Server.
|
||||
Smo.Server srv = new Smo.Server();
|
||||
// database name
|
||||
Console.WriteLine("Enter database name for scripting:");
|
||||
string dbName = Console.ReadLine();
|
||||
// Reference the database.
|
||||
Database db = srv.Databases[dbName];
|
||||
// Define a Scripter object and set the required scripting options.
|
||||
Scripter scripter = new Scripter(srv);
|
||||
scripter.Options.ScriptDrops = false;
|
||||
// To include indexes
|
||||
scripter.Options.Indexes = true;
|
||||
// to include referential constraints in the script
|
||||
scripter.Options.DriAllConstraints = true;
|
||||
// Iterate through the tables in database and script each one. Display the script.
|
||||
foreach (Table tb in db.Tables)
|
||||
{
|
||||
// check if the table is not a system table
|
||||
if (tb.IsSystemObject == false)
|
||||
{
|
||||
Console.WriteLine("-- Scripting for table " + tb.Name);
|
||||
// Generating script for table tb
|
||||
System.Collections.Specialized.StringCollection sc = scripter.Script(new Urn[] { tb.Urn });
|
||||
foreach (string st in sc)
|
||||
{
|
||||
Console.WriteLine(st);
|
||||
}
|
||||
Console.WriteLine("--");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
66
docs/samples/smo/net45/Scripting/Scripting.csproj
Normal file
66
docs/samples/smo/net45/Scripting/Scripting.csproj
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C0CACFBB-FDAF-4B3D-B9F7-EBC3179A5055}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.SqlServer.Management.SmoSdkSamples</RootNamespace>
|
||||
<AssemblyName>SmoSdkSamples</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.SqlServer.Management.Sdk.Sfc, Version=14.000.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SharedManagementObjects.140.1.9\lib\net40\Microsoft.SqlServer.Management.Sdk.Sfc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.SqlServer.Smo, Version=14.000.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SharedManagementObjects.140.1.9\lib\net40\Microsoft.SqlServer.Smo.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.SqlServer.SmoExtended, Version=14.000.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SharedManagementObjects.140.1.9\lib\net40\Microsoft.SqlServer.SmoExtended.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user