Skip to content

Commit 11040fd

Browse files
committed
remove zip and excess
1 parent 46fa446 commit 11040fd

File tree

90 files changed

+34152
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+34152
-0
lines changed
-38.8 MB
Binary file not shown.

samples/manage/azure-sql-db-elastic-pools-custom-dashboard/Contoso ShopKeeper/.vs/config/applicationhost.config

Lines changed: 1026 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<configSections>
4+
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
5+
<section name="LoadGeneratorConsole.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6+
</sectionGroup>
7+
</configSections>
8+
<startup>
9+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
10+
</startup>
11+
<connectionStrings>
12+
<add name="AdventureWorksCycles" connectionString="" providerName="System.Data.SqlClient" />
13+
</connectionStrings>
14+
<applicationSettings>
15+
<LoadGeneratorConsole.Properties.Settings>
16+
<setting name="Spike_DatabaseNames" serializeAs="Xml">
17+
<value>
18+
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
20+
<string>adventureworkscycles</string>
21+
<string>adventureworkscycles2</string>
22+
<string>adventureworkscycles3</string>
23+
<string>adventureworkscycles4</string>
24+
</ArrayOfString>
25+
</value>
26+
</setting>
27+
<setting name="Spike_NumRowsToInsert" serializeAs="String">
28+
<value>100000</value>
29+
</setting>
30+
<setting name="Spike_NumParallelClients" serializeAs="String">
31+
<value>16</value>
32+
</setting>
33+
</LoadGeneratorConsole.Properties.Settings>
34+
</applicationSettings>
35+
</configuration>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{5793D343-2B3C-492A-9765-FF765CAB93A6}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>LoadGeneratorConsole</RootNamespace>
11+
<AssemblyName>LoadGeneratorConsole</AssemblyName>
12+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Configuration" />
38+
<Reference Include="System.Core" />
39+
<Reference Include="System.Xml.Linq" />
40+
<Reference Include="System.Data.DataSetExtensions" />
41+
<Reference Include="Microsoft.CSharp" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Net.Http" />
44+
<Reference Include="System.Xml" />
45+
</ItemGroup>
46+
<ItemGroup>
47+
<Compile Include="Program.cs" />
48+
<Compile Include="Properties\AssemblyInfo.cs" />
49+
<Compile Include="Properties\Settings.Designer.cs">
50+
<AutoGen>True</AutoGen>
51+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
52+
<DependentUpon>Settings.settings</DependentUpon>
53+
</Compile>
54+
</ItemGroup>
55+
<ItemGroup>
56+
<None Include="App.config" />
57+
<None Include="Properties\Settings.settings">
58+
<Generator>SettingsSingleFileGenerator</Generator>
59+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
60+
</None>
61+
</ItemGroup>
62+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
63+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
64+
Other similar extension points exist, see Microsoft.Common.targets.
65+
<Target Name="BeforeBuild">
66+
</Target>
67+
<Target Name="AfterBuild">
68+
</Target>
69+
-->
70+
</Project>
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Data.SqlClient;
7+
8+
namespace LoadGeneratorConsole
9+
{
10+
class Program
11+
{
12+
static string _poolConnectionString;
13+
static int _numRowsToInsert = Properties.Settings.Default.Spike_NumRowsToInsert;
14+
static int _numTaskPerSpike = Properties.Settings.Default.Spike_NumParallelClients;
15+
16+
static void Main(string[] args)
17+
{
18+
_poolConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["AdventureWorksCycles"].ConnectionString;
19+
20+
List<Task> tasks = new List<Task>();
21+
22+
foreach (var dbname in Properties.Settings.Default.Spike_DatabaseNames)
23+
{
24+
tasks.AddRange(ScheduleLoadSpike(dbname, _numTaskPerSpike));
25+
}
26+
27+
Task.WaitAll( tasks.ToArray() ) ;
28+
Console.WriteLine("Tasks completed.");
29+
30+
Console.ReadLine();
31+
}
32+
33+
static Task[] ScheduleLoadSpike(string databaseName, int numTasks)
34+
{
35+
Task[] tasks = new Task[numTasks];
36+
for (int i =0; i<numTasks;i++)
37+
{
38+
tasks[i] = Task.Run(() => GenerateLoadSpike(databaseName));
39+
}
40+
41+
return tasks;
42+
}
43+
44+
static int _numTasks = 0;
45+
static int GenerateLoadSpike(string databaseName)
46+
{
47+
int taskID = System.Threading.Interlocked.Increment(ref _numTasks);
48+
Console.WriteLine("{0}_{1}: Preparing load spike...", databaseName, taskID);
49+
50+
SqlConnectionStringBuilder sqlConnBuilder = new SqlConnectionStringBuilder(_poolConnectionString);
51+
sqlConnBuilder.InitialCatalog = databaseName;
52+
string connectionString = sqlConnBuilder.ToString();
53+
54+
int numRowsAffected = 0;
55+
56+
try
57+
{
58+
59+
SqlConnection conn = new SqlConnection(connectionString);
60+
61+
string commandText = "INSERT [SalesLT].[SalesOrderHeader] (PurchaseOrderNumber, DueDate, CustomerID, ShipToAddressID, BillToAddressID, ShipMethod, SubTotal) " +
62+
"VALUES (@PoNum, @DueDate,@CustomerID, @ShipToAddressID, @BillToAddressID, @ShipMethod, @SubTotal) ";
63+
64+
Random r = new Random(1);
65+
66+
conn.Open();
67+
68+
for (int i = 0; i < _numRowsToInsert; i++)
69+
{
70+
// if a transient error closed our connection, create a new one and open it
71+
if(conn.State == System.Data.ConnectionState.Closed)
72+
{
73+
Console.ForegroundColor = ConsoleColor.Red;
74+
Console.WriteLine("{0}_{1}: Re-creating closed connection", databaseName, taskID);
75+
Console.ResetColor();
76+
conn = new SqlConnection(connectionString);
77+
conn.Open();
78+
}
79+
80+
81+
List<SqlParameter> parameters = new List<SqlParameter>() {
82+
new SqlParameter("@PoNum", String.Format("PO{0}{1}", DateTime.UtcNow.ToString("yyyymmddhhmmss"), r.Next(0,256)) ),
83+
new SqlParameter("@DueDate", DateTime.UtcNow.AddDays(3)),
84+
new SqlParameter("@CustomerID", 30089),
85+
new SqlParameter("@ShipToAddressID", 1034),
86+
new SqlParameter("@BillToAddressID", 1034),
87+
new SqlParameter("@ShipMethod", "CARGO TRANSPORT 5"),
88+
new SqlParameter("@SubTotal", 202.332M)};
89+
90+
91+
try
92+
{
93+
using (SqlCommand cmd = new SqlCommand(commandText, conn))
94+
{
95+
cmd.CommandType = System.Data.CommandType.Text;
96+
cmd.Parameters.AddRange(parameters.ToArray());
97+
numRowsAffected += cmd.ExecuteNonQuery();
98+
99+
}
100+
}
101+
catch (SqlException sqlex)
102+
{
103+
Console.ForegroundColor = ConsoleColor.Green;
104+
Console.WriteLine(sqlex.Message);
105+
Console.ResetColor();
106+
107+
System.Threading.Thread.Sleep(200);
108+
}
109+
catch (Exception cmdex)
110+
{
111+
Console.ForegroundColor = ConsoleColor.Blue;
112+
Console.WriteLine(cmdex.Message);
113+
Console.ResetColor();
114+
115+
}
116+
117+
if (i % 1000 == 0)
118+
{
119+
Console.WriteLine("{0}_{1}: Inserted {2} new rows so far", databaseName, taskID, numRowsAffected);
120+
}
121+
}
122+
123+
conn.Close();
124+
conn.Dispose();
125+
126+
Console.WriteLine("{0}_{1}: Inserted {1} new rows", databaseName, taskID, numRowsAffected);
127+
}
128+
catch (Exception ex)
129+
{
130+
Console.ForegroundColor = ConsoleColor.Red;
131+
Console.WriteLine(ex.Message);
132+
Console.ResetColor();
133+
}
134+
135+
Console.WriteLine("{0}_{1}: Finished with load spike.", databaseName, taskID);
136+
return numRowsAffected;
137+
}
138+
}
139+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("LoadGeneratorConsole")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("LoadGeneratorConsole")]
13+
[assembly: AssemblyCopyright("Copyright © 2016")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("5793d343-2b3c-492a-9765-ff765cab93a6")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

samples/manage/azure-sql-db-elastic-pools-custom-dashboard/Contoso ShopKeeper/LoadGeneratorConsole/Properties/Settings.Designer.cs

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="LoadGeneratorConsole.Properties" GeneratedClassName="Settings">
3+
<Profiles />
4+
<Settings>
5+
<Setting Name="Spike_DatabaseNames" Type="System.Collections.Specialized.StringCollection" Scope="Application">
6+
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
7+
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
8+
&lt;string&gt;soladventureworkscycles&lt;/string&gt;
9+
&lt;string&gt;soladventureworkscycles2&lt;/string&gt;
10+
&lt;string&gt;soladventureworkscycles3&lt;/string&gt;
11+
&lt;string&gt;soladventureworkscycles4&lt;/string&gt;
12+
&lt;/ArrayOfString&gt;</Value>
13+
</Setting>
14+
<Setting Name="Spike_NumRowsToInsert" Type="System.Int32" Scope="Application">
15+
<Value Profile="(Default)">100000</Value>
16+
</Setting>
17+
<Setting Name="Spike_NumParallelClients" Type="System.Int32" Scope="Application">
18+
<Value Profile="(Default)">16</Value>
19+
</Setting>
20+
</Settings>
21+
</SettingsFile>

0 commit comments

Comments
 (0)