This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Install: http://www.graphviz.org/Download..php | |
// | |
// 2. Add <appSettings> under <configuration> to app.config/web.config | |
// Add Nuget / Paket: GraphViz.NET | |
// | |
// 3. Add under <configuration><appSettings>: | |
// <add key="graphVizLocation" value="C:\Program Files (x86)\Graphviz2.38\bin" /> | |
// | |
// Add references to System.Configuration.dll and System.Drawing.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.CodeAnalysis; | |
using Microsoft.CodeAnalysis.CSharp; | |
using Microsoft.CodeAnalysis.CSharp.Syntax; | |
namespace Roslyn.CodeGeneration | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void KillDb(string connectionString, int timeoutMs) | |
{ | |
string dbName = GetDbName(connectionString); | |
Log.Info("kill database ", dbName); | |
var sqlCommandText = $@"USE master | |
DECLARE @kill varchar(8000) = ''; | |
SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), spid) + ';' | |
FROM master..sysprocesses | |
WHERE dbid = db_id('{dbName}') | |
EXEC(@kill); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
decimal[] arrayOfDecimals = JsonConvert.DeserializeObject<decimal[]>(jObject["Values"].ToString(Newtonsoft.Json.Formatting.None)); | |
decimal singleDecimal = JsonConvert.DeserializeObject<decimal>(jObject["Values"][1].ToString(Newtonsoft.Json.Formatting.None)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Use WMI for check percentage of CPU Usage | |
/// Write to private field _cpuUsage | |
/// </summary> | |
private void CheckCpuUsage() | |
{ | |
try | |
{ | |
var searcher = | |
new ManagementObjectSearcher("select * from Win32_PerfFormattedData_PerfOS_Processor"); |