diff --git a/AsTrace/ASTrace (Exe) - 2012/ASTrace.exe b/AsTrace/ASTrace (Exe) - 2012/ASTrace.exe
new file mode 100644
index 0000000..311121f
Binary files /dev/null and b/AsTrace/ASTrace (Exe) - 2012/ASTrace.exe differ
diff --git a/AsTrace/ASTrace (Exe) - 2012/ASTrace.exe.config b/AsTrace/ASTrace (Exe) - 2012/ASTrace.exe.config
new file mode 100644
index 0000000..8525b86
--- /dev/null
+++ b/AsTrace/ASTrace (Exe) - 2012/ASTrace.exe.config
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+ localhost,localhost\tabular
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+ 3
+
+
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AsTrace/ASTrace (Exe) - 2012/ASTrace.pdb b/AsTrace/ASTrace (Exe) - 2012/ASTrace.pdb
new file mode 100644
index 0000000..60d76b8
Binary files /dev/null and b/AsTrace/ASTrace (Exe) - 2012/ASTrace.pdb differ
diff --git a/AsTrace/ASTrace (Exe) - 2012/Capture AS Queries.tdf b/AsTrace/ASTrace (Exe) - 2012/Capture AS Queries.tdf
new file mode 100644
index 0000000..831f67b
Binary files /dev/null and b/AsTrace/ASTrace (Exe) - 2012/Capture AS Queries.tdf differ
diff --git a/AsTrace/ASTrace (Exe) - 2012/How to Install and Use ASTrace (2012).docx b/AsTrace/ASTrace (Exe) - 2012/How to Install and Use ASTrace (2012).docx
new file mode 100644
index 0000000..3d8eb72
Binary files /dev/null and b/AsTrace/ASTrace (Exe) - 2012/How to Install and Use ASTrace (2012).docx differ
diff --git a/AsTrace/ASTrace (Exe) - 2012/InstallUtil.exe b/AsTrace/ASTrace (Exe) - 2012/InstallUtil.exe
new file mode 100644
index 0000000..a62fd6d
Binary files /dev/null and b/AsTrace/ASTrace (Exe) - 2012/InstallUtil.exe differ
diff --git a/AsTrace/ASTrace (Exe) - 2012/InstallUtil.exe.config b/AsTrace/ASTrace (Exe) - 2012/InstallUtil.exe.config
new file mode 100644
index 0000000..0094e8d
--- /dev/null
+++ b/AsTrace/ASTrace (Exe) - 2012/InstallUtil.exe.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/AsTrace/ASTrace (Exe) - 2012/InstallUtilLib.dll b/AsTrace/ASTrace (Exe) - 2012/InstallUtilLib.dll
new file mode 100644
index 0000000..b1a7975
Binary files /dev/null and b/AsTrace/ASTrace (Exe) - 2012/InstallUtilLib.dll differ
diff --git a/AsTrace/ASTrace (Exe) - 2012/Standard.tdf b/AsTrace/ASTrace (Exe) - 2012/Standard.tdf
new file mode 100644
index 0000000..22f909c
Binary files /dev/null and b/AsTrace/ASTrace (Exe) - 2012/Standard.tdf differ
diff --git a/AsTrace/ASTrace (Exe) - 2012/install.bat b/AsTrace/ASTrace (Exe) - 2012/install.bat
new file mode 100644
index 0000000..4c9832a
--- /dev/null
+++ b/AsTrace/ASTrace (Exe) - 2012/install.bat
@@ -0,0 +1,3 @@
+cd /d "%~dp0"
+InstallUtil.exe ASTrace.exe
+pause
\ No newline at end of file
diff --git a/AsTrace/ASTrace (Exe) - 2012/uninstall.bat b/AsTrace/ASTrace (Exe) - 2012/uninstall.bat
new file mode 100644
index 0000000..ce6a259
--- /dev/null
+++ b/AsTrace/ASTrace (Exe) - 2012/uninstall.bat
@@ -0,0 +1,3 @@
+cd /d "%~dp0"
+InstallUtil.exe /u ASTrace.exe
+pause
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace.sln b/AsTrace/ASTrace CS - 2014/ASTrace.sln
new file mode 100644
index 0000000..724a991
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace.sln
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASTrace", "ASTrace\ASTrace.csproj", "{1B1359C0-AD58-4B92-966D-0110733AD0FF}"
+EndProject
+Global
+ GlobalSection(TeamFoundationVersionControl) = preSolution
+ SccNumberOfProjects = 2
+ SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+ SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs02
+ SccLocalPath0 = .
+ SccProjectUniqueName1 = ASTrace\\ASTrace.csproj
+ SccProjectName1 = ASTrace
+ SccLocalPath1 = ASTrace
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace.vssscc b/AsTrace/ASTrace CS - 2014/ASTrace.vssscc
new file mode 100644
index 0000000..6cb031b
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace.vssscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj
new file mode 100644
index 0000000..174ad3f
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj
@@ -0,0 +1,95 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}
+ WinExe
+ Properties
+ ASTrace
+ ASTrace
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ 2.0
+ 0
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ x86
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ x86
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+ ProjectInstaller.cs
+
+
+ True
+ True
+ Settings.settings
+
+
+ Component
+
+
+ Service1.cs
+
+
+
+
+
+
+
+ Designer
+ ProjectInstaller.cs
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj.user b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj.user
new file mode 100644
index 0000000..c8dfea1
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj.user
@@ -0,0 +1,16 @@
+
+
+ publish\
+
+
+
+
+
+
+
+
+ 0
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj.vspscc b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2012.csproj.vspscc b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2012.csproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2012.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2014.csproj b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2014.csproj
new file mode 100644
index 0000000..f3b96f5
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2014.csproj
@@ -0,0 +1,135 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}
+ WinExe
+ Properties
+ ASTrace
+ ASTrace
+ v4.0
+
+
+ 2.0
+
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ x86
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ x86
+ true
+
+
+
+ False
+ ..\..\..\Program Files\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll
+
+
+ False
+ ..\..\..\Program Files\Microsoft SQL Server\120\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfoExtended.dll
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+ ProjectInstaller.cs
+
+
+ True
+ True
+ Settings.settings
+
+
+ Component
+
+
+ Service1.cs
+
+
+
+
+
+
+
+ Designer
+ ProjectInstaller.cs
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2014.csproj.user b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2014.csproj.user
new file mode 100644
index 0000000..6f23531
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ASTrace2014.csproj.user
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/Program.cs b/AsTrace/ASTrace CS - 2014/ASTrace/Program.cs
new file mode 100644
index 0000000..a9bcf4a
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/Program.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+using System.ServiceProcess;
+using System.Text;
+
+namespace ASTrace
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ static void Main()
+ {
+ ServiceBase[] ServicesToRun;
+
+ // More than one user Service may run within the same process. To add
+ // another service to this process, change the following line to
+ // create a second service object. For example,
+ //
+ // ServicesToRun = new ServiceBase[] {new ASTrace(), new MySecondUserService()};
+ //
+ ServicesToRun = new ServiceBase[] { new Trace() };
+
+ ServiceBase.Run(ServicesToRun);
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.Designer.cs b/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.Designer.cs
new file mode 100644
index 0000000..188761a
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.Designer.cs
@@ -0,0 +1,62 @@
+namespace ASTrace
+{
+ partial class ProjectInstaller
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
+ this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
+ //
+ // serviceProcessInstaller1
+ //
+ this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
+ this.serviceProcessInstaller1.Password = null;
+ this.serviceProcessInstaller1.Username = null;
+ this.serviceProcessInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceProcessInstaller1_AfterInstall);
+ //
+ // serviceInstaller1
+ //
+ this.serviceInstaller1.Description = "Analysis Services Trace Sample Service";
+ this.serviceInstaller1.DisplayName = "ASTrace";
+ this.serviceInstaller1.ServiceName = "ASTrace";
+ this.serviceInstaller1.BeforeUninstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_BeforeUninstall);
+ this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
+ //
+ // ProjectInstaller
+ //
+ this.Installers.AddRange(new System.Configuration.Install.Installer[] {
+ this.serviceProcessInstaller1,
+ this.serviceInstaller1});
+
+ }
+
+ #endregion
+
+ private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
+ private System.ServiceProcess.ServiceInstaller serviceInstaller1;
+ }
+}
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.cs b/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.cs
new file mode 100644
index 0000000..7a35a6c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration.Install;
+
+namespace ASTrace
+{
+ [RunInstaller(true)]
+ public partial class ProjectInstaller : Installer
+ {
+ public ProjectInstaller()
+ {
+ InitializeComponent();
+ }
+
+ private void serviceProcessInstaller1_AfterInstall(object sender, InstallEventArgs e)
+ {
+
+ Microsoft.Win32.RegistryKey software, microsoft, astrace;
+ software = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE");
+ microsoft = software.OpenSubKey("Microsoft", true);
+ astrace = microsoft.CreateSubKey("ASTrace");
+ astrace.SetValue("path", Environment.CurrentDirectory);
+ }
+
+ private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
+ {
+
+ }
+
+ private void serviceInstaller1_BeforeUninstall(object sender, InstallEventArgs e)
+ {
+ try
+ {
+ Microsoft.Win32.RegistryKey software, microsoft;
+ software = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE");
+ microsoft = software.OpenSubKey("Microsoft",true);
+ microsoft.DeleteSubKey("ASTrace");
+ }
+ catch { }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.resx b/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.resx
new file mode 100644
index 0000000..0663ffb
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/ProjectInstaller.resx
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 11
+
+
+ 221, 17
+
+
+ False
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/Properties/AssemblyInfo.cs b/AsTrace/ASTrace CS - 2014/ASTrace/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..4cccb5d
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ASTrace")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ASTrace")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+[assembly: CLSCompliant(true)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("49f2e12f-ed21-4372-9097-ee25cb7318ff")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("2.1.0.0")]
+[assembly: AssemblyFileVersion("2.1.0.0")]
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/Properties/Settings.Designer.cs b/AsTrace/ASTrace CS - 2014/ASTrace/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..946a382
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/Properties/Settings.Designer.cs
@@ -0,0 +1,116 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.5466
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace ASTrace.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string AnalysisServerName {
+ get {
+ return ((string)(this["AnalysisServerName"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("localhost")]
+ public string SQLServer {
+ get {
+ return ((string)(this["SQLServer"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("TraceDB")]
+ public string SQLServerDatabase {
+ get {
+ return ((string)(this["SQLServerDatabase"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("ASTraceTable")]
+ public string TraceTableName {
+ get {
+ return ((string)(this["TraceTableName"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Standard.tdf")]
+ public string TraceDefinition {
+ get {
+ return ((string)(this["TraceDefinition"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool PreserveHistory {
+ get {
+ return ((bool)(this["PreserveHistory"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string AnalysisServerNames {
+ get {
+ return ((string)(this["AnalysisServerNames"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool AppendDateToSQLTable {
+ get {
+ return ((bool)(this["AppendDateToSQLTable"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("3")]
+ public int RestartRetries {
+ get {
+ return ((int)(this["RestartRetries"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("5")]
+ public int RestartDelayMinutes {
+ get {
+ return ((int)(this["RestartDelayMinutes"]));
+ }
+ }
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/Properties/Settings.settings b/AsTrace/ASTrace CS - 2014/ASTrace/Properties/Settings.settings
new file mode 100644
index 0000000..37e28f8
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/Properties/Settings.settings
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/Service1.Designer.cs b/AsTrace/ASTrace CS - 2014/ASTrace/Service1.Designer.cs
new file mode 100644
index 0000000..325626b
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/Service1.Designer.cs
@@ -0,0 +1,37 @@
+namespace ASTrace
+{
+ partial class Trace
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ this.ServiceName = "ASTrace";
+ }
+
+ #endregion
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/Service1.cs b/AsTrace/ASTrace CS - 2014/ASTrace/Service1.cs
new file mode 100644
index 0000000..59d10a0
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/Service1.cs
@@ -0,0 +1,442 @@
+/*============================================================================
+ File: Service1.cs
+
+ Summary: Contains class implementiong ASTrace service
+
+ Part of ASTrace
+
+ Date: January 2007
+------------------------------------------------------------------------------
+ This file is part of the Microsoft SQL Server Code Samples.
+
+ Copyright (C) Microsoft Corporation. All rights reserved.
+
+ This source code is intended only as a supplement to Microsoft
+ Development Tools and/or on-line documentation. See these other
+ materials for detailed information regarding Microsoft code samples.
+
+ THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
+ PARTICULAR PURPOSE.
+============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.ServiceProcess;
+using System.Text;
+using System.Threading;
+using System.IO;
+using Microsoft.SqlServer.Management.Trace;
+using Microsoft.SqlServer.Management.Common;
+
+namespace ASTrace
+{
+ public partial class Trace : ServiceBase
+ {
+ List workers = new List();
+ string localPath;
+ List _ServernamesList;
+ int _NumInstance;
+ TextWriter writer;
+ List traceServers = new List();
+
+ public Trace()
+ {
+ //Have seen errors here, normally when configuring for first time
+ //Note, the eventlog will need to create a source the very first time it runs and that needs admin privs.
+ try
+ {
+ InitializeComponent();
+ // Read registry to find out where the service executable is installed
+ Microsoft.Win32.RegistryKey software, microsoft, astrace;
+ software = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE");
+ microsoft = software.OpenSubKey("Microsoft");
+ astrace = microsoft.OpenSubKey("ASTrace");
+ localPath = (string)astrace.GetValue("path");
+ writer = new StreamWriter(localPath + "\\ASTraceService.log", true);
+ WriteLog(DateTime.Now.ToString() + ": Service Started in '" + localPath + "'");
+ }
+ catch (Exception ex)
+ {
+ StringBuilder messageText = new StringBuilder();
+
+ messageText.Append("Failed to write to log file ").AppendLine();
+ messageText.Append("Error: " + ex.Message).AppendLine();
+
+ while (ex.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(ex.InnerException.Message).AppendLine();
+ messageText.Append(ex.InnerException.StackTrace).AppendLine();
+
+ ex = ex.InnerException;
+ }
+
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+ }
+ }
+
+ protected override void OnStart(string[] args)
+ {
+
+ if (Properties.Settings.Default.AppendDateToSQLTable && Properties.Settings.Default.PreserveHistory)
+ {
+ StringBuilder messageText = new StringBuilder();
+ messageText.Append(DateTime.Now.ToString() + ": Both AppendDateToSQLTable and PreserveHistory cannot be true!");
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+ WriteLog(messageText.ToString());
+ Stop();
+ return;
+ }
+
+ //Initial startup so get the server list
+ string sServerNames = Properties.Settings.Default.AnalysisServerName + "," + Properties.Settings.Default.AnalysisServerNames;
+ _ServernamesList = new List(sServerNames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
+ //Get the number of servers so we can maintain legacy behaviour
+ _NumInstance = _ServernamesList.Count;
+
+ foreach (string SSASserver in _ServernamesList)
+ {
+ //Spin up a thread to write the trace to SQL
+ Thread worker = new Thread(DoWork);
+ workers.Add(worker);
+ //Start the tracing and pass SSAS Server name so we can handle retries
+ worker.Start(SSASserver);
+ }
+ }
+
+
+ bool ConnectOlap(out TraceServer traceServer, string SSASserver)
+ {
+
+ OlapConnectionInfo ci = new OlapConnectionInfo();
+ traceServer = new TraceServer();
+ StringBuilder messageText = new StringBuilder();
+
+ try
+ {
+ ci.UseIntegratedSecurity = true;
+ ci.ServerName = SSASserver;
+ string tracetemplate = localPath + "\\" + Properties.Settings.Default.TraceDefinition;
+ traceServer.InitializeAsReader(ci, tracetemplate);
+
+ lock (traceServers)
+ {
+ traceServers.Add(traceServer);
+ }
+
+ messageText.Append(
+ DateTime.Now.ToString()
+ + ": Created trace for Analysis Server : '"
+ + SSASserver
+ + "'");
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Information);
+
+ return true;
+ }
+
+ catch (Exception e)
+ {
+
+ messageText.Append(DateTime.Now.ToString() + ": Cannot start Analysis Server trace: ").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Analysis Server name: '" + SSASserver + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Trace definition : '" + localPath + "\\" + Properties.Settings.Default.TraceDefinition + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Error: " + e.Message).AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Stack Trace: " + e.StackTrace).AppendLine();
+
+ while (e.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(e.InnerException.Message).AppendLine();
+ messageText.Append(e.InnerException.StackTrace).AppendLine();
+
+ e = e.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+
+ return false;
+ }
+ }
+
+ bool ConnectSQL(ref TraceServer traceServer, out TraceTable tableWriter, string SSASserver)
+ {
+ SqlConnectionInfo connInfo = new SqlConnectionInfo(Properties.Settings.Default.SQLServer);
+ StringBuilder messageText = new StringBuilder();
+
+ string _AppendInst = "_" + SSASserver;
+ string _SQLTable;
+ string _AppendDate;
+
+ //Maintains legacy logic where by a server with single instance does not have any inst names appended.
+ if (_NumInstance == 1)
+ _AppendInst = "";
+ //Append data to end of SQL table. Useful as an alternative to preserver SQL but data only survives 1 restart a day and you need cleanup logic in SQL Server
+ if (Properties.Settings.Default.AppendDateToSQLTable)
+ _AppendDate = "_" + DateTime.Now.ToString("yyyyMMdd");
+ else
+ _AppendDate = "";
+
+ _SQLTable =
+ Properties.Settings.Default.TraceTableName
+ + _AppendInst
+ + _AppendDate;
+
+ if (Properties.Settings.Default.PreserveHistory)
+ PreserveSQLHistory(ref _SQLTable);
+
+ tableWriter = new TraceTable();
+
+ try
+ {
+ connInfo.DatabaseName = Properties.Settings.Default.SQLServerDatabase;
+ tableWriter.InitializeAsWriter(traceServer, connInfo, _SQLTable);
+
+ messageText.Append(DateTime.Now.ToString() + ": Created Analysis Server trace table: '" + _SQLTable + "' on SQL Server: '" + Properties.Settings.Default.SQLServer
+ + "' in database: " + Properties.Settings.Default.SQLServerDatabase + "'");
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Information);
+ return true;
+ }
+
+ catch (Exception e)
+ {
+ messageText.Append(DateTime.Now.ToString() + ": Cannot create Analysis Server trace table: '" + SSASserver + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": SQL Server Name: '" + Properties.Settings.Default.SQLServer + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": SQL Server Database : '" + Properties.Settings.Default.SQLServerDatabase + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": SQL Server Table : '" + _SQLTable + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Error: " + e.Message).AppendLine();
+
+ while (e.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(e.InnerException.Message).AppendLine();
+ messageText.Append(e.InnerException.StackTrace.ToString()).AppendLine();
+
+ e = e.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+
+ return false;
+ }
+ }
+
+ void PreserveSQLHistory(ref string _SQLTable)
+ {
+ string sHistorySuffix = "History";
+ if (_NumInstance > 1)
+ {
+ sHistorySuffix = "_History";
+ }
+ StringBuilder messageText = new StringBuilder();
+ try
+ {
+
+ SqlConnectionInfo connInfo = new SqlConnectionInfo(Properties.Settings.Default.SQLServer);
+ IDbConnection conn = connInfo.CreateConnectionObject();
+ conn.Open();
+ conn.ChangeDatabase(Properties.Settings.Default.SQLServerDatabase);
+
+ string sSQL = @"if object_id('[" + _SQLTable.Replace("'", "''") + @"]') is not null
+ select top 1 * from [" + _SQLTable.Replace("]", "]]") + "]";
+ System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sSQL, (System.Data.SqlClient.SqlConnection)conn);
+ cmd.CommandTimeout = 0;
+ System.Data.SqlClient.SqlDataReader datareader = cmd.ExecuteReader();
+ string sColumns = "";
+ for (int i = 0; i < datareader.FieldCount; i++)
+ {
+ if (!string.IsNullOrEmpty(sColumns)) sColumns += ", ";
+ sColumns += "[" + datareader.GetName(i) + "]";
+ }
+ datareader.Close();
+
+ if (sColumns != "")
+ {
+ sSQL = @"
+ if object_id('[" + _SQLTable.Replace("'", "''") + @"]') is not null
+ begin
+ if object_id('[" + _SQLTable.Replace("'", "''") + sHistorySuffix + @"]') is null
+ begin
+ select * into [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + "] from [" + _SQLTable.Replace("]", "]]") + @"]
+ end
+ else
+ begin
+ SET IDENTITY_INSERT [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + @"] ON
+ insert into [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + "] (" + sColumns + @")
+ select * from [" + _SQLTable.Replace("]", "]]") + @"]
+ SET IDENTITY_INSERT [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + @"] OFF
+ end
+ end
+ ";
+
+ cmd.CommandText = sSQL;
+ int iRowsPreserved = cmd.ExecuteNonQuery();
+
+ messageText.Append(DateTime.Now.ToString() + ": Successfully preserved " + iRowsPreserved + " rows of history to table: " + _SQLTable + sHistorySuffix);
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Information);
+ }
+
+ conn.Close();
+ conn.Dispose();
+ }
+ catch (Exception ex)
+ {
+ messageText.Append(DateTime.Now.ToString() + ": Cannot preserve history of trace table. ").AppendLine();
+ messageText.Append("Error: " + ex.Message).AppendLine();
+ messageText.Append(ex.StackTrace).AppendLine();
+
+ while (ex.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(ex.InnerException.Message).AppendLine();
+ messageText.Append(ex.InnerException.StackTrace).AppendLine();
+
+ ex = ex.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Warning);
+ }
+ }
+
+ void DoWork(object SSAS)
+ {
+ string SSASserver = (string)SSAS;
+ TraceTable _SQLDestTableWriter = null;
+ TraceServer _SSASSourceTraceServer = null;
+ int _RetryCounter = 0;
+ bool bFirstLoop = true;
+
+ while (bFirstLoop || _RetryCounter < Properties.Settings.Default.RestartRetries)
+ {
+ bFirstLoop = false;
+ try
+ {
+ //Grab connection to SSAS
+ bool bSuccess = ConnectOlap(out _SSASSourceTraceServer, SSASserver);
+
+ if (bSuccess)
+ {
+ //Grab connection to SQL and connect it with the SSAS trace
+ bSuccess = ConnectSQL(ref _SSASSourceTraceServer, out _SQLDestTableWriter, SSASserver);
+
+ if (bSuccess)
+ {
+ _RetryCounter = 0;
+
+ while (_SQLDestTableWriter.Write())
+ {
+ if (_SQLDestTableWriter.IsClosed)
+ throw new Exception("SQL connection closed unexpectedly.");
+ if (_SSASSourceTraceServer.IsClosed)
+ throw new Exception("SSAS connection closed unexpectedly.");
+ }
+ }
+ }
+ }
+
+ catch (Exception ex)
+ {
+ StringBuilder messageText = new StringBuilder();
+
+ messageText.Append(DateTime.Now.ToString() + ": Error reading trace: " + ex.Message).AppendLine();
+ messageText.Append(ex.StackTrace).AppendLine();
+
+ while (ex.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(ex.InnerException.Message).AppendLine();
+ messageText.Append(ex.InnerException.StackTrace).AppendLine();
+
+ ex = ex.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Warning);
+ }
+
+ try
+ {
+ _SSASSourceTraceServer.Stop();
+ _SSASSourceTraceServer.Close();
+ }
+ catch { }
+ try
+ {
+ _SQLDestTableWriter.Close();
+ }
+ catch { }
+
+
+ _RetryCounter++;
+
+ if (_RetryCounter < Properties.Settings.Default.RestartRetries)
+ {
+ StringBuilder messageText2 = new StringBuilder();
+ messageText2.Append(DateTime.Now.ToString() + ": Exception caught tracing server: " + SSASserver + ", retry " + _RetryCounter + " of " + Properties.Settings.Default.RestartRetries
+ + ". Pausing for " + Properties.Settings.Default.RestartDelayMinutes + " minute(s) then restarting automatically"
+ ).AppendLine();
+ WriteLog(messageText2.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText2.ToString(), EventLogEntryType.Warning);
+ System.Threading.Thread.Sleep(new TimeSpan(0, Properties.Settings.Default.RestartDelayMinutes, 0));
+ }
+ else
+ {
+ WriteLog(DateTime.Now.ToString() + ": Exceeded the number of allowed retries for server: " + SSASserver);
+ }
+ }
+
+ //if this one trace exceeded the number of retries so stop the service and stop all traces
+ Stop();
+ }
+
+ protected override void OnStop()
+ {
+ try
+ {
+ WriteLog(DateTime.Now.ToString() + ": Stopping");
+ writer.Close();
+ writer.Dispose();
+ }
+ catch { }
+
+ try
+ {
+ foreach (TraceServer ts in traceServers)
+ {
+ try
+ {
+ ts.Stop();
+ ts.Close();
+ ts.Dispose();
+ }
+ catch { }
+ }
+ }
+ catch { }
+ }
+
+ private void WriteLog(string sMessage)
+ {
+ lock (writer)
+ {
+ try
+ {
+ writer.WriteLine(sMessage);
+ writer.Flush();
+ }
+ catch { }
+ }
+ }
+
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/Settings.cs b/AsTrace/ASTrace CS - 2014/ASTrace/Settings.cs
new file mode 100644
index 0000000..e2d63a2
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/Settings.cs
@@ -0,0 +1,28 @@
+namespace ASTrace.Properties {
+
+
+ // This class allows you to handle specific events on the settings class:
+ // The SettingChanging event is raised before a setting's value is changed.
+ // The PropertyChanged event is raised after a setting's value is changed.
+ // The SettingsLoaded event is raised after the setting values are loaded.
+ // The SettingsSaving event is raised before the setting values are saved.
+ internal sealed partial class Settings {
+
+ public Settings() {
+ // // To add event handlers for saving and changing settings, uncomment the lines below:
+ //
+ // this.SettingChanging += this.SettingChangingEventHandler;
+ //
+ // this.SettingsSaving += this.SettingsSavingEventHandler;
+ //
+ }
+
+ private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
+ // Add code to handle the SettingChangingEvent event here.
+ }
+
+ private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
+ // Add code to handle the SettingsSaving event here.
+ }
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/app.config b/AsTrace/ASTrace CS - 2014/ASTrace/app.config
new file mode 100644
index 0000000..720192c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/app.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.exe b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.exe
new file mode 100644
index 0000000..396be01
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.exe differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.exe.config b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.exe.config
new file mode 100644
index 0000000..720192c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.exe.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.pdb b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.pdb
new file mode 100644
index 0000000..84cc02c
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.pdb differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe
new file mode 100644
index 0000000..666c0af
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe.config b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe.config
new file mode 100644
index 0000000..720192c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe.manifest b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe.manifest
new file mode 100644
index 0000000..061c9ca
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/bin/Debug/ASTrace.vshost.exe.manifest
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.ProjectInstaller.resources b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.ProjectInstaller.resources
new file mode 100644
index 0000000..6c05a97
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.ProjectInstaller.resources differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.exe b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.exe
new file mode 100644
index 0000000..396be01
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.exe differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.pdb b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.pdb
new file mode 100644
index 0000000..84cc02c
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace.pdb differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csproj.FileListAbsolute.txt b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..6390744
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csproj.FileListAbsolute.txt
@@ -0,0 +1,8 @@
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe.config
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.pdb
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2012.csprojResolveAssemblyReference.cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.ProjectInstaller.resources
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2012.csproj.GenerateResource.Cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.pdb
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csproj.GenerateResource.Cache b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csproj.GenerateResource.Cache
new file mode 100644
index 0000000..6188f10
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csproj.GenerateResource.Cache differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csprojResolveAssemblyReference.cache b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csprojResolveAssemblyReference.cache
new file mode 100644
index 0000000..02ab006
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2012.csprojResolveAssemblyReference.cache differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csproj.FileListAbsolute.txt b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..7823d14
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csproj.FileListAbsolute.txt
@@ -0,0 +1,8 @@
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe.config
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.pdb
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2014.csprojResolveAssemblyReference.cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.ProjectInstaller.resources
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2014.csproj.GenerateResource.Cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.pdb
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csproj.GenerateResource.Cache b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csproj.GenerateResource.Cache
new file mode 100644
index 0000000..6188f10
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csproj.GenerateResource.Cache differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csprojResolveAssemblyReference.cache b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csprojResolveAssemblyReference.cache
new file mode 100644
index 0000000..1aedf1f
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/ASTrace2014.csprojResolveAssemblyReference.cache differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000..7abb9c0
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace2012.vssscc b/AsTrace/ASTrace CS - 2014/ASTrace2012.vssscc
new file mode 100644
index 0000000..6cb031b
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace2012.vssscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace2014.sln b/AsTrace/ASTrace CS - 2014/ASTrace2014.sln
new file mode 100644
index 0000000..7a9c2db
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2014/ASTrace2014.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.40629.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASTrace2014", "ASTrace\ASTrace2014.csproj", "{1B1359C0-AD58-4B92-966D-0110733AD0FF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace2014.suo b/AsTrace/ASTrace CS - 2014/ASTrace2014.suo
new file mode 100644
index 0000000..5b3e535
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace2014.suo differ
diff --git a/AsTrace/ASTrace CS - 2014/ASTrace2014.v12.suo b/AsTrace/ASTrace CS - 2014/ASTrace2014.v12.suo
new file mode 100644
index 0000000..298961c
Binary files /dev/null and b/AsTrace/ASTrace CS - 2014/ASTrace2014.v12.suo differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace.sln b/AsTrace/ASTrace CS - 2016/ASTrace.sln
new file mode 100644
index 0000000..724a991
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace.sln
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASTrace", "ASTrace\ASTrace.csproj", "{1B1359C0-AD58-4B92-966D-0110733AD0FF}"
+EndProject
+Global
+ GlobalSection(TeamFoundationVersionControl) = preSolution
+ SccNumberOfProjects = 2
+ SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
+ SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs02
+ SccLocalPath0 = .
+ SccProjectUniqueName1 = ASTrace\\ASTrace.csproj
+ SccProjectName1 = ASTrace
+ SccLocalPath1 = ASTrace
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace.vssscc b/AsTrace/ASTrace CS - 2016/ASTrace.vssscc
new file mode 100644
index 0000000..6cb031b
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace.vssscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj
new file mode 100644
index 0000000..174ad3f
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj
@@ -0,0 +1,95 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}
+ WinExe
+ Properties
+ ASTrace
+ ASTrace
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ 2.0
+ 0
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ x86
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ x86
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+ ProjectInstaller.cs
+
+
+ True
+ True
+ Settings.settings
+
+
+ Component
+
+
+ Service1.cs
+
+
+
+
+
+
+
+ Designer
+ ProjectInstaller.cs
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj.user b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj.user
new file mode 100644
index 0000000..c8dfea1
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj.user
@@ -0,0 +1,16 @@
+
+
+ publish\
+
+
+
+
+
+
+
+
+ 0
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj.vspscc b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2012.csproj.vspscc b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2012.csproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2012.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2016.csproj b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2016.csproj
new file mode 100644
index 0000000..dd53409
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2016.csproj
@@ -0,0 +1,135 @@
+
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}
+ WinExe
+ Properties
+ ASTrace
+ ASTrace
+ v4.0
+
+
+ 2.0
+
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ x86
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ x86
+ true
+
+
+
+ False
+ ..\..\..\Program Files\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll
+
+
+ False
+ ..\..\..\Program Files\Microsoft SQL Server\130\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfoExtended.dll
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+ ProjectInstaller.cs
+
+
+ True
+ True
+ Settings.settings
+
+
+ Component
+
+
+ Service1.cs
+
+
+
+
+
+
+
+ Designer
+ ProjectInstaller.cs
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2016.csproj.user b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2016.csproj.user
new file mode 100644
index 0000000..6f23531
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ASTrace2016.csproj.user
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+ en-US
+ false
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/Program.cs b/AsTrace/ASTrace CS - 2016/ASTrace/Program.cs
new file mode 100644
index 0000000..a9bcf4a
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/Program.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+using System.ServiceProcess;
+using System.Text;
+
+namespace ASTrace
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ static void Main()
+ {
+ ServiceBase[] ServicesToRun;
+
+ // More than one user Service may run within the same process. To add
+ // another service to this process, change the following line to
+ // create a second service object. For example,
+ //
+ // ServicesToRun = new ServiceBase[] {new ASTrace(), new MySecondUserService()};
+ //
+ ServicesToRun = new ServiceBase[] { new Trace() };
+
+ ServiceBase.Run(ServicesToRun);
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.Designer.cs b/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.Designer.cs
new file mode 100644
index 0000000..188761a
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.Designer.cs
@@ -0,0 +1,62 @@
+namespace ASTrace
+{
+ partial class ProjectInstaller
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
+ this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
+ //
+ // serviceProcessInstaller1
+ //
+ this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
+ this.serviceProcessInstaller1.Password = null;
+ this.serviceProcessInstaller1.Username = null;
+ this.serviceProcessInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceProcessInstaller1_AfterInstall);
+ //
+ // serviceInstaller1
+ //
+ this.serviceInstaller1.Description = "Analysis Services Trace Sample Service";
+ this.serviceInstaller1.DisplayName = "ASTrace";
+ this.serviceInstaller1.ServiceName = "ASTrace";
+ this.serviceInstaller1.BeforeUninstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_BeforeUninstall);
+ this.serviceInstaller1.AfterInstall += new System.Configuration.Install.InstallEventHandler(this.serviceInstaller1_AfterInstall);
+ //
+ // ProjectInstaller
+ //
+ this.Installers.AddRange(new System.Configuration.Install.Installer[] {
+ this.serviceProcessInstaller1,
+ this.serviceInstaller1});
+
+ }
+
+ #endregion
+
+ private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
+ private System.ServiceProcess.ServiceInstaller serviceInstaller1;
+ }
+}
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.cs b/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.cs
new file mode 100644
index 0000000..7a35a6c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration.Install;
+
+namespace ASTrace
+{
+ [RunInstaller(true)]
+ public partial class ProjectInstaller : Installer
+ {
+ public ProjectInstaller()
+ {
+ InitializeComponent();
+ }
+
+ private void serviceProcessInstaller1_AfterInstall(object sender, InstallEventArgs e)
+ {
+
+ Microsoft.Win32.RegistryKey software, microsoft, astrace;
+ software = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE");
+ microsoft = software.OpenSubKey("Microsoft", true);
+ astrace = microsoft.CreateSubKey("ASTrace");
+ astrace.SetValue("path", Environment.CurrentDirectory);
+ }
+
+ private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)
+ {
+
+ }
+
+ private void serviceInstaller1_BeforeUninstall(object sender, InstallEventArgs e)
+ {
+ try
+ {
+ Microsoft.Win32.RegistryKey software, microsoft;
+ software = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE");
+ microsoft = software.OpenSubKey("Microsoft",true);
+ microsoft.DeleteSubKey("ASTrace");
+ }
+ catch { }
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.resx b/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.resx
new file mode 100644
index 0000000..0663ffb
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/ProjectInstaller.resx
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 11
+
+
+ 221, 17
+
+
+ False
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/Properties/AssemblyInfo.cs b/AsTrace/ASTrace CS - 2016/ASTrace/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..4cccb5d
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ASTrace")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ASTrace")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+[assembly: CLSCompliant(true)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("49f2e12f-ed21-4372-9097-ee25cb7318ff")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("2.1.0.0")]
+[assembly: AssemblyFileVersion("2.1.0.0")]
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/Properties/Settings.Designer.cs b/AsTrace/ASTrace CS - 2016/ASTrace/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..946a382
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/Properties/Settings.Designer.cs
@@ -0,0 +1,116 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.5466
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace ASTrace.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string AnalysisServerName {
+ get {
+ return ((string)(this["AnalysisServerName"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("localhost")]
+ public string SQLServer {
+ get {
+ return ((string)(this["SQLServer"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("TraceDB")]
+ public string SQLServerDatabase {
+ get {
+ return ((string)(this["SQLServerDatabase"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("ASTraceTable")]
+ public string TraceTableName {
+ get {
+ return ((string)(this["TraceTableName"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Standard.tdf")]
+ public string TraceDefinition {
+ get {
+ return ((string)(this["TraceDefinition"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool PreserveHistory {
+ get {
+ return ((bool)(this["PreserveHistory"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string AnalysisServerNames {
+ get {
+ return ((string)(this["AnalysisServerNames"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("False")]
+ public bool AppendDateToSQLTable {
+ get {
+ return ((bool)(this["AppendDateToSQLTable"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("3")]
+ public int RestartRetries {
+ get {
+ return ((int)(this["RestartRetries"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("5")]
+ public int RestartDelayMinutes {
+ get {
+ return ((int)(this["RestartDelayMinutes"]));
+ }
+ }
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/Properties/Settings.settings b/AsTrace/ASTrace CS - 2016/ASTrace/Properties/Settings.settings
new file mode 100644
index 0000000..37e28f8
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/Properties/Settings.settings
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
\ No newline at end of file
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/Service1.Designer.cs b/AsTrace/ASTrace CS - 2016/ASTrace/Service1.Designer.cs
new file mode 100644
index 0000000..325626b
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/Service1.Designer.cs
@@ -0,0 +1,37 @@
+namespace ASTrace
+{
+ partial class Trace
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ this.ServiceName = "ASTrace";
+ }
+
+ #endregion
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/Service1.cs b/AsTrace/ASTrace CS - 2016/ASTrace/Service1.cs
new file mode 100644
index 0000000..59d10a0
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/Service1.cs
@@ -0,0 +1,442 @@
+/*============================================================================
+ File: Service1.cs
+
+ Summary: Contains class implementiong ASTrace service
+
+ Part of ASTrace
+
+ Date: January 2007
+------------------------------------------------------------------------------
+ This file is part of the Microsoft SQL Server Code Samples.
+
+ Copyright (C) Microsoft Corporation. All rights reserved.
+
+ This source code is intended only as a supplement to Microsoft
+ Development Tools and/or on-line documentation. See these other
+ materials for detailed information regarding Microsoft code samples.
+
+ THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
+ PARTICULAR PURPOSE.
+============================================================================*/
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.ServiceProcess;
+using System.Text;
+using System.Threading;
+using System.IO;
+using Microsoft.SqlServer.Management.Trace;
+using Microsoft.SqlServer.Management.Common;
+
+namespace ASTrace
+{
+ public partial class Trace : ServiceBase
+ {
+ List workers = new List();
+ string localPath;
+ List _ServernamesList;
+ int _NumInstance;
+ TextWriter writer;
+ List traceServers = new List();
+
+ public Trace()
+ {
+ //Have seen errors here, normally when configuring for first time
+ //Note, the eventlog will need to create a source the very first time it runs and that needs admin privs.
+ try
+ {
+ InitializeComponent();
+ // Read registry to find out where the service executable is installed
+ Microsoft.Win32.RegistryKey software, microsoft, astrace;
+ software = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE");
+ microsoft = software.OpenSubKey("Microsoft");
+ astrace = microsoft.OpenSubKey("ASTrace");
+ localPath = (string)astrace.GetValue("path");
+ writer = new StreamWriter(localPath + "\\ASTraceService.log", true);
+ WriteLog(DateTime.Now.ToString() + ": Service Started in '" + localPath + "'");
+ }
+ catch (Exception ex)
+ {
+ StringBuilder messageText = new StringBuilder();
+
+ messageText.Append("Failed to write to log file ").AppendLine();
+ messageText.Append("Error: " + ex.Message).AppendLine();
+
+ while (ex.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(ex.InnerException.Message).AppendLine();
+ messageText.Append(ex.InnerException.StackTrace).AppendLine();
+
+ ex = ex.InnerException;
+ }
+
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+ }
+ }
+
+ protected override void OnStart(string[] args)
+ {
+
+ if (Properties.Settings.Default.AppendDateToSQLTable && Properties.Settings.Default.PreserveHistory)
+ {
+ StringBuilder messageText = new StringBuilder();
+ messageText.Append(DateTime.Now.ToString() + ": Both AppendDateToSQLTable and PreserveHistory cannot be true!");
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+ WriteLog(messageText.ToString());
+ Stop();
+ return;
+ }
+
+ //Initial startup so get the server list
+ string sServerNames = Properties.Settings.Default.AnalysisServerName + "," + Properties.Settings.Default.AnalysisServerNames;
+ _ServernamesList = new List(sServerNames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
+ //Get the number of servers so we can maintain legacy behaviour
+ _NumInstance = _ServernamesList.Count;
+
+ foreach (string SSASserver in _ServernamesList)
+ {
+ //Spin up a thread to write the trace to SQL
+ Thread worker = new Thread(DoWork);
+ workers.Add(worker);
+ //Start the tracing and pass SSAS Server name so we can handle retries
+ worker.Start(SSASserver);
+ }
+ }
+
+
+ bool ConnectOlap(out TraceServer traceServer, string SSASserver)
+ {
+
+ OlapConnectionInfo ci = new OlapConnectionInfo();
+ traceServer = new TraceServer();
+ StringBuilder messageText = new StringBuilder();
+
+ try
+ {
+ ci.UseIntegratedSecurity = true;
+ ci.ServerName = SSASserver;
+ string tracetemplate = localPath + "\\" + Properties.Settings.Default.TraceDefinition;
+ traceServer.InitializeAsReader(ci, tracetemplate);
+
+ lock (traceServers)
+ {
+ traceServers.Add(traceServer);
+ }
+
+ messageText.Append(
+ DateTime.Now.ToString()
+ + ": Created trace for Analysis Server : '"
+ + SSASserver
+ + "'");
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Information);
+
+ return true;
+ }
+
+ catch (Exception e)
+ {
+
+ messageText.Append(DateTime.Now.ToString() + ": Cannot start Analysis Server trace: ").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Analysis Server name: '" + SSASserver + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Trace definition : '" + localPath + "\\" + Properties.Settings.Default.TraceDefinition + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Error: " + e.Message).AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Stack Trace: " + e.StackTrace).AppendLine();
+
+ while (e.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(e.InnerException.Message).AppendLine();
+ messageText.Append(e.InnerException.StackTrace).AppendLine();
+
+ e = e.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+
+ return false;
+ }
+ }
+
+ bool ConnectSQL(ref TraceServer traceServer, out TraceTable tableWriter, string SSASserver)
+ {
+ SqlConnectionInfo connInfo = new SqlConnectionInfo(Properties.Settings.Default.SQLServer);
+ StringBuilder messageText = new StringBuilder();
+
+ string _AppendInst = "_" + SSASserver;
+ string _SQLTable;
+ string _AppendDate;
+
+ //Maintains legacy logic where by a server with single instance does not have any inst names appended.
+ if (_NumInstance == 1)
+ _AppendInst = "";
+ //Append data to end of SQL table. Useful as an alternative to preserver SQL but data only survives 1 restart a day and you need cleanup logic in SQL Server
+ if (Properties.Settings.Default.AppendDateToSQLTable)
+ _AppendDate = "_" + DateTime.Now.ToString("yyyyMMdd");
+ else
+ _AppendDate = "";
+
+ _SQLTable =
+ Properties.Settings.Default.TraceTableName
+ + _AppendInst
+ + _AppendDate;
+
+ if (Properties.Settings.Default.PreserveHistory)
+ PreserveSQLHistory(ref _SQLTable);
+
+ tableWriter = new TraceTable();
+
+ try
+ {
+ connInfo.DatabaseName = Properties.Settings.Default.SQLServerDatabase;
+ tableWriter.InitializeAsWriter(traceServer, connInfo, _SQLTable);
+
+ messageText.Append(DateTime.Now.ToString() + ": Created Analysis Server trace table: '" + _SQLTable + "' on SQL Server: '" + Properties.Settings.Default.SQLServer
+ + "' in database: " + Properties.Settings.Default.SQLServerDatabase + "'");
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Information);
+ return true;
+ }
+
+ catch (Exception e)
+ {
+ messageText.Append(DateTime.Now.ToString() + ": Cannot create Analysis Server trace table: '" + SSASserver + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": SQL Server Name: '" + Properties.Settings.Default.SQLServer + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": SQL Server Database : '" + Properties.Settings.Default.SQLServerDatabase + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": SQL Server Table : '" + _SQLTable + "'").AppendLine();
+ messageText.Append(DateTime.Now.ToString() + ": Error: " + e.Message).AppendLine();
+
+ while (e.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(e.InnerException.Message).AppendLine();
+ messageText.Append(e.InnerException.StackTrace.ToString()).AppendLine();
+
+ e = e.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Error);
+
+ return false;
+ }
+ }
+
+ void PreserveSQLHistory(ref string _SQLTable)
+ {
+ string sHistorySuffix = "History";
+ if (_NumInstance > 1)
+ {
+ sHistorySuffix = "_History";
+ }
+ StringBuilder messageText = new StringBuilder();
+ try
+ {
+
+ SqlConnectionInfo connInfo = new SqlConnectionInfo(Properties.Settings.Default.SQLServer);
+ IDbConnection conn = connInfo.CreateConnectionObject();
+ conn.Open();
+ conn.ChangeDatabase(Properties.Settings.Default.SQLServerDatabase);
+
+ string sSQL = @"if object_id('[" + _SQLTable.Replace("'", "''") + @"]') is not null
+ select top 1 * from [" + _SQLTable.Replace("]", "]]") + "]";
+ System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sSQL, (System.Data.SqlClient.SqlConnection)conn);
+ cmd.CommandTimeout = 0;
+ System.Data.SqlClient.SqlDataReader datareader = cmd.ExecuteReader();
+ string sColumns = "";
+ for (int i = 0; i < datareader.FieldCount; i++)
+ {
+ if (!string.IsNullOrEmpty(sColumns)) sColumns += ", ";
+ sColumns += "[" + datareader.GetName(i) + "]";
+ }
+ datareader.Close();
+
+ if (sColumns != "")
+ {
+ sSQL = @"
+ if object_id('[" + _SQLTable.Replace("'", "''") + @"]') is not null
+ begin
+ if object_id('[" + _SQLTable.Replace("'", "''") + sHistorySuffix + @"]') is null
+ begin
+ select * into [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + "] from [" + _SQLTable.Replace("]", "]]") + @"]
+ end
+ else
+ begin
+ SET IDENTITY_INSERT [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + @"] ON
+ insert into [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + "] (" + sColumns + @")
+ select * from [" + _SQLTable.Replace("]", "]]") + @"]
+ SET IDENTITY_INSERT [" + _SQLTable.Replace("]", "]]") + sHistorySuffix + @"] OFF
+ end
+ end
+ ";
+
+ cmd.CommandText = sSQL;
+ int iRowsPreserved = cmd.ExecuteNonQuery();
+
+ messageText.Append(DateTime.Now.ToString() + ": Successfully preserved " + iRowsPreserved + " rows of history to table: " + _SQLTable + sHistorySuffix);
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Information);
+ }
+
+ conn.Close();
+ conn.Dispose();
+ }
+ catch (Exception ex)
+ {
+ messageText.Append(DateTime.Now.ToString() + ": Cannot preserve history of trace table. ").AppendLine();
+ messageText.Append("Error: " + ex.Message).AppendLine();
+ messageText.Append(ex.StackTrace).AppendLine();
+
+ while (ex.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(ex.InnerException.Message).AppendLine();
+ messageText.Append(ex.InnerException.StackTrace).AppendLine();
+
+ ex = ex.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Warning);
+ }
+ }
+
+ void DoWork(object SSAS)
+ {
+ string SSASserver = (string)SSAS;
+ TraceTable _SQLDestTableWriter = null;
+ TraceServer _SSASSourceTraceServer = null;
+ int _RetryCounter = 0;
+ bool bFirstLoop = true;
+
+ while (bFirstLoop || _RetryCounter < Properties.Settings.Default.RestartRetries)
+ {
+ bFirstLoop = false;
+ try
+ {
+ //Grab connection to SSAS
+ bool bSuccess = ConnectOlap(out _SSASSourceTraceServer, SSASserver);
+
+ if (bSuccess)
+ {
+ //Grab connection to SQL and connect it with the SSAS trace
+ bSuccess = ConnectSQL(ref _SSASSourceTraceServer, out _SQLDestTableWriter, SSASserver);
+
+ if (bSuccess)
+ {
+ _RetryCounter = 0;
+
+ while (_SQLDestTableWriter.Write())
+ {
+ if (_SQLDestTableWriter.IsClosed)
+ throw new Exception("SQL connection closed unexpectedly.");
+ if (_SSASSourceTraceServer.IsClosed)
+ throw new Exception("SSAS connection closed unexpectedly.");
+ }
+ }
+ }
+ }
+
+ catch (Exception ex)
+ {
+ StringBuilder messageText = new StringBuilder();
+
+ messageText.Append(DateTime.Now.ToString() + ": Error reading trace: " + ex.Message).AppendLine();
+ messageText.Append(ex.StackTrace).AppendLine();
+
+ while (ex.InnerException != null)
+ {
+ messageText.Append("INNER EXCEPTION: ");
+ messageText.Append(ex.InnerException.Message).AppendLine();
+ messageText.Append(ex.InnerException.StackTrace).AppendLine();
+
+ ex = ex.InnerException;
+ }
+
+ WriteLog(messageText.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText.ToString(), EventLogEntryType.Warning);
+ }
+
+ try
+ {
+ _SSASSourceTraceServer.Stop();
+ _SSASSourceTraceServer.Close();
+ }
+ catch { }
+ try
+ {
+ _SQLDestTableWriter.Close();
+ }
+ catch { }
+
+
+ _RetryCounter++;
+
+ if (_RetryCounter < Properties.Settings.Default.RestartRetries)
+ {
+ StringBuilder messageText2 = new StringBuilder();
+ messageText2.Append(DateTime.Now.ToString() + ": Exception caught tracing server: " + SSASserver + ", retry " + _RetryCounter + " of " + Properties.Settings.Default.RestartRetries
+ + ". Pausing for " + Properties.Settings.Default.RestartDelayMinutes + " minute(s) then restarting automatically"
+ ).AppendLine();
+ WriteLog(messageText2.ToString());
+ EventLog.WriteEntry(this.ServiceName, messageText2.ToString(), EventLogEntryType.Warning);
+ System.Threading.Thread.Sleep(new TimeSpan(0, Properties.Settings.Default.RestartDelayMinutes, 0));
+ }
+ else
+ {
+ WriteLog(DateTime.Now.ToString() + ": Exceeded the number of allowed retries for server: " + SSASserver);
+ }
+ }
+
+ //if this one trace exceeded the number of retries so stop the service and stop all traces
+ Stop();
+ }
+
+ protected override void OnStop()
+ {
+ try
+ {
+ WriteLog(DateTime.Now.ToString() + ": Stopping");
+ writer.Close();
+ writer.Dispose();
+ }
+ catch { }
+
+ try
+ {
+ foreach (TraceServer ts in traceServers)
+ {
+ try
+ {
+ ts.Stop();
+ ts.Close();
+ ts.Dispose();
+ }
+ catch { }
+ }
+ }
+ catch { }
+ }
+
+ private void WriteLog(string sMessage)
+ {
+ lock (writer)
+ {
+ try
+ {
+ writer.WriteLine(sMessage);
+ writer.Flush();
+ }
+ catch { }
+ }
+ }
+
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/Settings.cs b/AsTrace/ASTrace CS - 2016/ASTrace/Settings.cs
new file mode 100644
index 0000000..e2d63a2
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/Settings.cs
@@ -0,0 +1,28 @@
+namespace ASTrace.Properties {
+
+
+ // This class allows you to handle specific events on the settings class:
+ // The SettingChanging event is raised before a setting's value is changed.
+ // The PropertyChanged event is raised after a setting's value is changed.
+ // The SettingsLoaded event is raised after the setting values are loaded.
+ // The SettingsSaving event is raised before the setting values are saved.
+ internal sealed partial class Settings {
+
+ public Settings() {
+ // // To add event handlers for saving and changing settings, uncomment the lines below:
+ //
+ // this.SettingChanging += this.SettingChangingEventHandler;
+ //
+ // this.SettingsSaving += this.SettingsSavingEventHandler;
+ //
+ }
+
+ private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
+ // Add code to handle the SettingChangingEvent event here.
+ }
+
+ private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
+ // Add code to handle the SettingsSaving event here.
+ }
+ }
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/app.config b/AsTrace/ASTrace CS - 2016/ASTrace/app.config
new file mode 100644
index 0000000..720192c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/app.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.exe b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.exe
new file mode 100644
index 0000000..c1860eb
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.exe differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.exe.config b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.exe.config
new file mode 100644
index 0000000..720192c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.exe.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.pdb b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.pdb
new file mode 100644
index 0000000..21681be
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.pdb differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe
new file mode 100644
index 0000000..666c0af
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe.config b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe.config
new file mode 100644
index 0000000..720192c
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe.config
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+
+
+ TraceDB
+
+
+ ASTraceTable
+
+
+ Standard.tdf
+
+
+ True
+
+
+
+
+
+ False
+
+
+ 3
+
+
+ 5
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe.manifest b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe.manifest
new file mode 100644
index 0000000..061c9ca
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/bin/Debug/ASTrace.vshost.exe.manifest
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.ProjectInstaller.resources b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.ProjectInstaller.resources
new file mode 100644
index 0000000..6c05a97
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.ProjectInstaller.resources differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.exe b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.exe
new file mode 100644
index 0000000..c1860eb
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.exe differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.pdb b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.pdb
new file mode 100644
index 0000000..21681be
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace.pdb differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csproj.FileListAbsolute.txt b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..6390744
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csproj.FileListAbsolute.txt
@@ -0,0 +1,8 @@
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe.config
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.pdb
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2012.csprojResolveAssemblyReference.cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.ProjectInstaller.resources
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2012.csproj.GenerateResource.Cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.pdb
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csproj.GenerateResource.Cache b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csproj.GenerateResource.Cache
new file mode 100644
index 0000000..6188f10
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csproj.GenerateResource.Cache differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csprojResolveAssemblyReference.cache b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csprojResolveAssemblyReference.cache
new file mode 100644
index 0000000..02ab006
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2012.csprojResolveAssemblyReference.cache differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csproj.FileListAbsolute.txt b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..447f8ef
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csproj.FileListAbsolute.txt
@@ -0,0 +1,16 @@
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe.config
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\bin\Debug\ASTrace.pdb
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2014.csprojResolveAssemblyReference.cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.ProjectInstaller.resources
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace2014.csproj.GenerateResource.Cache
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.exe
+C:\ASTrace\CS\ASTrace\obj\Debug\ASTrace.pdb
+C:\ASTrace\CS - 2016\ASTrace\bin\Debug\ASTrace.exe.config
+C:\ASTrace\CS - 2016\ASTrace\obj\Debug\ASTrace.exe
+C:\ASTrace\CS - 2016\ASTrace\obj\Debug\ASTrace.pdb
+C:\ASTrace\CS - 2016\ASTrace\bin\Debug\ASTrace.exe
+C:\ASTrace\CS - 2016\ASTrace\bin\Debug\ASTrace.pdb
+C:\ASTrace\CS - 2016\ASTrace\obj\Debug\ASTrace2014.csprojResolveAssemblyReference.cache
+C:\ASTrace\CS - 2016\ASTrace\obj\Debug\ASTrace.ProjectInstaller.resources
+C:\ASTrace\CS - 2016\ASTrace\obj\Debug\ASTrace2014.csproj.GenerateResource.Cache
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csproj.GenerateResource.Cache b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csproj.GenerateResource.Cache
new file mode 100644
index 0000000..6188f10
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csproj.GenerateResource.Cache differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csprojResolveAssemblyReference.cache b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csprojResolveAssemblyReference.cache
new file mode 100644
index 0000000..9438139
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/ASTrace2014.csprojResolveAssemblyReference.cache differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000..6e4c35a
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace2012.vssscc b/AsTrace/ASTrace CS - 2016/ASTrace2012.vssscc
new file mode 100644
index 0000000..6cb031b
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace2012.vssscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = ""
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT"
+}
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace2014.suo b/AsTrace/ASTrace CS - 2016/ASTrace2014.suo
new file mode 100644
index 0000000..5b3e535
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace2014.suo differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace2016.sln b/AsTrace/ASTrace CS - 2016/ASTrace2016.sln
new file mode 100644
index 0000000..7cbc507
--- /dev/null
+++ b/AsTrace/ASTrace CS - 2016/ASTrace2016.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2013
+VisualStudioVersion = 12.0.40629.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASTrace2016", "ASTrace\ASTrace2016.csproj", "{1B1359C0-AD58-4B92-966D-0110733AD0FF}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B1359C0-AD58-4B92-966D-0110733AD0FF}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace2016.suo b/AsTrace/ASTrace CS - 2016/ASTrace2016.suo
new file mode 100644
index 0000000..298961c
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace2016.suo differ
diff --git a/AsTrace/ASTrace CS - 2016/ASTrace2016.v12.suo b/AsTrace/ASTrace CS - 2016/ASTrace2016.v12.suo
new file mode 100644
index 0000000..02ff031
Binary files /dev/null and b/AsTrace/ASTrace CS - 2016/ASTrace2016.v12.suo differ
diff --git a/AsTrace/How to Install and Use ASTrace (2012).docx b/AsTrace/How to Install and Use ASTrace (2012).docx
new file mode 100644
index 0000000..3d8eb72
Binary files /dev/null and b/AsTrace/How to Install and Use ASTrace (2012).docx differ
diff --git a/AsTrace/LICENSE b/AsTrace/LICENSE
new file mode 100644
index 0000000..11a398c
--- /dev/null
+++ b/AsTrace/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2016 karanspeaks
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/AsTrace/README.md b/AsTrace/README.md
new file mode 100644
index 0000000..c4074ac
--- /dev/null
+++ b/AsTrace/README.md
@@ -0,0 +1,2 @@
+# SQL-Server-Analysis-Services-Community-Samples
+This project contains SQL Server Analysis Services samples.