mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 01:25:41 -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:
42
docs/samples/smo/netcore/ModifySetting/Program.cs
Normal file
42
docs/samples/smo/netcore/ModifySetting/Program.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Microsoft.Data.Tools.DataSets;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using System;
|
||||
|
||||
namespace Microsoft.SqlServer.Management.SmoSdkSamples
|
||||
{
|
||||
// This example displays information about the instance of SQL Server in Information and Settings, and modifies settings in Settings and UserOptionsobject properties.
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
//Connect to the local, default instance of SQL Server.
|
||||
Microsoft.SqlServer.Management.Smo.Server srv = new Microsoft.SqlServer.Management.Smo.Server();
|
||||
//Display all the configuration options.
|
||||
foreach (ConfigProperty p in srv.Configuration.Properties)
|
||||
{
|
||||
Console.WriteLine(p.DisplayName);
|
||||
}
|
||||
Console.WriteLine("There are " + srv.Configuration.Properties.Count.ToString() + " configuration options.");
|
||||
//Display the maximum and minimum values for ShowAdvancedOptions.
|
||||
int min = srv.Configuration.ShowAdvancedOptions.Minimum;
|
||||
int max = srv.Configuration.ShowAdvancedOptions.Maximum;
|
||||
Console.WriteLine("Minimum and Maximum values are " + min + " and " + max + ".");
|
||||
int configvalue = srv.Configuration.ShowAdvancedOptions.ConfigValue;
|
||||
//Modify the value of ShowAdvancedOptions and run the Alter method.
|
||||
srv.Configuration.ShowAdvancedOptions.ConfigValue = 0;
|
||||
srv.Configuration.Alter();
|
||||
//Display when the change takes place according to the IsDynamic property.
|
||||
if (srv.Configuration.ShowAdvancedOptions.IsDynamic == true)
|
||||
{
|
||||
Console.WriteLine("Configuration option has been updated.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Configuration option will be updated when SQL Server is restarted.");
|
||||
}
|
||||
// Recover setting value
|
||||
srv.Configuration.ShowAdvancedOptions.ConfigValue = configvalue;
|
||||
srv.Configuration.Alter();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
docs/samples/smo/netcore/ModifySetting/project.json
Normal file
21
docs/samples/smo/netcore/ModifySetting/project.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"version": "1.0.0-*",
|
||||
"buildOptions": {
|
||||
"debugType": "portable",
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.SqlServer.Smo": "140.1.12"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
},
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user