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
2 changes: 1 addition & 1 deletion .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 2 additions & 0 deletions src/LightQueryProfiler.Highlight/Extensions/XmlExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public static string GetAttributeValue(this XElement element, XName name)
var attribute = element.Attribute(name);
if (attribute == null)
{
#pragma warning disable CS8603 // Possible null reference return.
return null;
#pragma warning restore CS8603 // Possible null reference return.
}

return attribute.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SixLabors.Fonts" Version="2.0.1" />
<PackageReference Include="SixLabors.Fonts" Version="2.1.2" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/LightQueryProfiler.Shared/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Data.Common;
using System.Data.SqlClient;
using Microsoft.Data.SqlClient;

namespace LightQueryProfiler.Shared.Data
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand All @@ -13,8 +13,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.3" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.4" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public async Task AddAsync(Connection entity)
const string sql = @"INSERT INTO Connections (DataSource, InitialCatalog, UserId, Password, IntegratedSecurity, CreationDate)
VALUES (@DataSource, @InitialCatalog, @UserId, @Password, @IntegratedSecurity, @CreationDate)";

await using var db = _context.GetConnection() as SqliteConnection;
await using var db = _context.GetConnection() as SqliteConnection ?? throw new Exception("db cannot be null or empty"); ;
await using SqliteCommand sqliteCommand = new SqliteCommand(sql, db);
sqliteCommand.Parameters.AddWithValue("@DataSource", entity.DataSource);
sqliteCommand.Parameters.AddWithValue("@InitialCatalog", entity.InitialCatalog);
Expand All @@ -45,7 +45,7 @@ public async Task AddAsync(Connection entity)
public async Task Delete(int id)
{
const string sql = "DELETE FROM Connections WHERE Id = @Id";
await using var db = _context.GetConnection() as SqliteConnection;
await using var db = _context.GetConnection() as SqliteConnection ?? throw new Exception("db cannot be null or empty");
await using SqliteCommand sqliteCommand = new SqliteCommand(sql, db);
sqliteCommand.Parameters.AddWithValue("@Id", id);

Expand All @@ -57,7 +57,7 @@ public async Task<IList<Connection>> GetAllAsync()
{
const string sql = "SELECT Id, InitialCatalog, CreationDate, DataSource, IntegratedSecurity, Password, UserId FROM Connections";
List<Connection> connections = new List<Connection>();
await using var db = _context.GetConnection() as SqliteConnection;
await using var db = _context.GetConnection() as SqliteConnection ?? throw new Exception("db cannot be null or empty");
await using SqliteCommand sqliteCommand = new SqliteCommand(sql, db);

await db.OpenAsync();
Expand Down Expand Up @@ -86,7 +86,7 @@ public async Task<Connection> GetByIdAsync(int id)
{
const string sql = "SELECT Id, InitialCatalog, CreationDate, DataSource, IntegratedSecurity, Password, UserId FROM Connections WHERE Id = @Id";
Connection? connection = null;
await using var db = _context.GetConnection() as SqliteConnection;
await using var db = _context.GetConnection() as SqliteConnection ?? throw new Exception("db cannot be null or empty");
await using SqliteCommand sqliteCommand = new SqliteCommand(sql, db);
sqliteCommand.Parameters.AddWithValue("@Id", id);

Expand Down Expand Up @@ -117,7 +117,7 @@ public async Task<Connection> GetByIdAsync(int id)
public async Task UpdateAsync(Connection entity)
{
const string sql = "UPDATE Connections SET DataSource=@DataSource, InitialCatalog=@InitialCatalog, UserId=@UserId, Password=@Password, IntegratedSecurity=@IntegratedSecurity WHERE Id = @Id";
await using var db = _context.GetConnection() as SqliteConnection;
await using var db = _context.GetConnection() as SqliteConnection ?? throw new Exception("db cannot be null or empty");
await using SqliteCommand sqliteCommand = new SqliteCommand(sql, db);
sqliteCommand.Parameters.AddWithValue("@Id", entity);
sqliteCommand.Parameters.AddWithValue("@DataSource", entity.DataSource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using LightQueryProfiler.Shared.Repositories.Interfaces;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using Microsoft.Data.SqlClient;

namespace LightQueryProfiler.Shared.Repositories
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AssemblyName>LightQueryProfiler</AssemblyName>
<Version>1.0.0-alpha02</Version>
<Version>1.0.0</Version>
<FileVersion>1.0.0</FileVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\LightQueryProfiler.Highlight\LightQueryProfiler.Highlight.csproj" />
<ProjectReference Include="..\LightQueryProfiler.Shared\LightQueryProfiler.Shared.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using LightQueryProfiler.Shared.Services.Interfaces;
using LightQueryProfiler.WinFormsApp.Data;
using LightQueryProfiler.WinFormsApp.Views;
using System.Data.SqlClient;
using Microsoft.Data.SqlClient;

namespace LightQueryProfiler.WinFormsApp.Presenters
{
Expand Down
7 changes: 7 additions & 0 deletions src/LightQueryProfiler.WinFormsApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ internal static class Program
[STAThread]
private static void Main()
{
// Enable modern visual styles
Application.EnableVisualStyles();
// Optional: Improve text rendering
Application.SetCompatibleTextRenderingDefault(false);

Application.SetHighDpiMode(HighDpiMode.SystemAware);

// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/LightQueryProfiler.WinFormsApp/Views/AboutView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace LightQueryProfiler.WinFormsApp.Views
using System.ComponentModel;

namespace LightQueryProfiler.WinFormsApp.Views
{
public partial class AboutView : Form, IAboutView
{
Expand All @@ -16,6 +18,7 @@ public AboutView()

public Form Form => this;

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Version { get => lblVersion.Text; set => lblVersion.Text = value; }

private void BtnOK_Click(object? sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions src/LightQueryProfiler.WinFormsApp/Views/AboutView.resx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema

Version 2.0

Expand Down Expand Up @@ -48,7 +48,7 @@
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
Expand Down
16 changes: 8 additions & 8 deletions src/LightQueryProfiler.WinFormsApp/Views/FiltersView.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/LightQueryProfiler.WinFormsApp/Views/FiltersView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using LightQueryProfiler.Shared.Models;
using System.ComponentModel;

namespace LightQueryProfiler.WinFormsApp.Views
{
Expand All @@ -14,6 +15,7 @@ public FiltersView()

public event EventHandler? OnClose;

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public EventFilter EventFilter { get => GetEventFilter(); set => SetEventFilter(value); }

public Form Form => this;
Expand Down
6 changes: 3 additions & 3 deletions src/LightQueryProfiler.WinFormsApp/Views/FiltersView.resx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema

Version 2.0

Expand All @@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
Expand Down Expand Up @@ -48,7 +48,7 @@
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.

mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
Expand Down
2 changes: 2 additions & 0 deletions src/LightQueryProfiler.WinFormsApp/Views/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
}
set
{
tscAuthentication.ComboBox.SelectedValue = value;

Check warning on line 119 in src/LightQueryProfiler.WinFormsApp/Views/MainView.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.

Check warning on line 119 in src/LightQueryProfiler.WinFormsApp/Views/MainView.cs

View workflow job for this annotation

GitHub Actions / build

Possible null reference assignment.
}
}

Expand Down Expand Up @@ -263,6 +263,7 @@
selectConnectionMenu.Click += SelectConnectionMenu_Click;
recentMenu.DropDownItems.Add(selectConnectionMenu);

ms.RenderMode = ToolStripRenderMode.System;
ms.Items.Add(fileMenu);
ms.Items.Add(recentMenu);
ms.Items.Add(helpMenu);
Expand All @@ -272,6 +273,7 @@

private void CreateMainToolBar()
{
toolStripMain.RenderMode = ToolStripRenderMode.System;
toolStripMain.Dock = DockStyle.Top;
toolStripMain.AutoSize = true;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="NUnit" Version="4.3.2" />
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.7.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down