Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions doc/apps/AzureSqlConnector/AzureSqlConnector.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- Choose and enter target framework: net481 or net9.0-windows -->
<TargetFramework Condition="'$(OS)' == 'Windows_NT'">net481</TargetFramework>
<TargetFramework Condition="'$(OS)' != 'Windows_NT'">net9.0-windows</TargetFramework>
<EnableWindowsTargeting Condition="'$(OS)' != 'Windows_NT'">true</EnableWindowsTargeting>
<OutputType>WinExe</OutputType>
<RootNamespace>Microsoft.Data.SqlClient.Samples.AzureSqlConnector</RootNamespace>
<AssemblyName>AzureSqlConnector</AssemblyName>
<UseWindowsForms>true</UseWindowsForms>
<LangVersion>latest</LangVersion>
<Nullable>disable</Nullable>
<Platforms>AnyCPU</Platforms>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<IsPackable>false</IsPackable>
</PropertyGroup>

<!-- On 6.1, Azure auth lives inside the main Microsoft.Data.SqlClient assembly,
so the sample references the netcore/netfx Microsoft.Data.SqlClient project directly -->

<!-- .NET Framework target framework dependencies -->
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="Microsoft.Data.SqlClient.SNI" />
<ProjectReference Include="..\..\..\src\Microsoft.Data.SqlClient\netfx\src\Microsoft.Data.SqlClient.csproj" />
</ItemGroup>

<!-- .NET Runtime target framework dependencies -->
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" />
<ProjectReference Include="..\..\..\src\Microsoft.Data.SqlClient\netcore\src\Microsoft.Data.SqlClient.csproj" />
</ItemGroup>

</Project>


25 changes: 25 additions & 0 deletions doc/apps/AzureSqlConnector/IdentityQuery.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace Microsoft.Data.SqlClient.Samples.AzureSqlConnector
{
/// <summary>
/// Shared SQL text used by both <see cref="MainForm"/> (UI-thread variant) and
/// <see cref="MainFormWorker"/> (worker-thread variant). Keeping the literal in one place
/// avoids drift when one variant gains a new column.
/// </summary>
internal static class IdentityQuery
{
public const string CommandText =
"SELECT " +
" SUSER_SNAME() AS LoggedInUser, " +
" ORIGINAL_LOGIN() AS OriginalLogin, " +
" USER_NAME() AS DatabaseUser, " +
" SUSER_ID() AS LoginSid, " +
" DB_NAME() AS DatabaseName, " +
" @@SERVERNAME AS ServerName, " +
" HOST_NAME() AS ClientHost, " +
" APP_NAME() AS AppName, " +
" SESSION_USER AS SessionUser, " +
" CURRENT_USER AS CurrentUser, " +
" @@SPID AS SessionId, " +
" @@VERSION AS ServerVersion;";
}
}
394 changes: 394 additions & 0 deletions doc/apps/AzureSqlConnector/MainForm.Designer.cs

Large diffs are not rendered by default.

Loading
Loading