diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml
index 9337b0e..4b372a7 100644
--- a/.github/workflows/build-ci.yml
+++ b/.github/workflows/build-ci.yml
@@ -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
diff --git a/src/LightQueryProfiler.Highlight/Extensions/XmlExtensions.cs b/src/LightQueryProfiler.Highlight/Extensions/XmlExtensions.cs
index d76a6f1..9d5e9e9 100644
--- a/src/LightQueryProfiler.Highlight/Extensions/XmlExtensions.cs
+++ b/src/LightQueryProfiler.Highlight/Extensions/XmlExtensions.cs
@@ -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;
diff --git a/src/LightQueryProfiler.Highlight/LightQueryProfiler.Highlight.csproj b/src/LightQueryProfiler.Highlight/LightQueryProfiler.Highlight.csproj
index dd12e3f..17bfe86 100644
--- a/src/LightQueryProfiler.Highlight/LightQueryProfiler.Highlight.csproj
+++ b/src/LightQueryProfiler.Highlight/LightQueryProfiler.Highlight.csproj
@@ -1,13 +1,13 @@
- net7.0
+ net9.0
enable
enable
-
+
diff --git a/src/LightQueryProfiler.Shared/Data/ApplicationDbContext.cs b/src/LightQueryProfiler.Shared/Data/ApplicationDbContext.cs
index 21609dd..49e4159 100644
--- a/src/LightQueryProfiler.Shared/Data/ApplicationDbContext.cs
+++ b/src/LightQueryProfiler.Shared/Data/ApplicationDbContext.cs
@@ -1,5 +1,5 @@
using System.Data.Common;
-using System.Data.SqlClient;
+using Microsoft.Data.SqlClient;
namespace LightQueryProfiler.Shared.Data
{
diff --git a/src/LightQueryProfiler.Shared/LightQueryProfiler.Shared.csproj b/src/LightQueryProfiler.Shared/LightQueryProfiler.Shared.csproj
index 418df62..f7e3b93 100644
--- a/src/LightQueryProfiler.Shared/LightQueryProfiler.Shared.csproj
+++ b/src/LightQueryProfiler.Shared/LightQueryProfiler.Shared.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net9.0
enable
enable
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/src/LightQueryProfiler.Shared/Repositories/ConnectionRepository.cs b/src/LightQueryProfiler.Shared/Repositories/ConnectionRepository.cs
index e027b0a..4296ff5 100644
--- a/src/LightQueryProfiler.Shared/Repositories/ConnectionRepository.cs
+++ b/src/LightQueryProfiler.Shared/Repositories/ConnectionRepository.cs
@@ -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);
@@ -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);
@@ -57,7 +57,7 @@ public async Task> GetAllAsync()
{
const string sql = "SELECT Id, InitialCatalog, CreationDate, DataSource, IntegratedSecurity, Password, UserId FROM Connections";
List connections = new List();
- 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();
@@ -86,7 +86,7 @@ public async Task 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);
@@ -117,7 +117,7 @@ public async Task 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);
diff --git a/src/LightQueryProfiler.Shared/Repositories/XEventRepository.cs b/src/LightQueryProfiler.Shared/Repositories/XEventRepository.cs
index 20e7498..8525e8e 100644
--- a/src/LightQueryProfiler.Shared/Repositories/XEventRepository.cs
+++ b/src/LightQueryProfiler.Shared/Repositories/XEventRepository.cs
@@ -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
{
diff --git a/src/LightQueryProfiler.WinFormsApp/LightQueryProfiler.WinFormsApp.csproj b/src/LightQueryProfiler.WinFormsApp/LightQueryProfiler.WinFormsApp.csproj
index 696d92e..746cb18 100644
--- a/src/LightQueryProfiler.WinFormsApp/LightQueryProfiler.WinFormsApp.csproj
+++ b/src/LightQueryProfiler.WinFormsApp/LightQueryProfiler.WinFormsApp.csproj
@@ -2,17 +2,21 @@
WinExe
- net7.0-windows
+ net9.0-windows
enable
true
enable
true
LightQueryProfiler
- 1.0.0-alpha02
+ 1.0.0
1.0.0
1.0.0
+
+
+
+
diff --git a/src/LightQueryProfiler.WinFormsApp/Presenters/MainPresenter.cs b/src/LightQueryProfiler.WinFormsApp/Presenters/MainPresenter.cs
index bdf2638..ad7fa05 100644
--- a/src/LightQueryProfiler.WinFormsApp/Presenters/MainPresenter.cs
+++ b/src/LightQueryProfiler.WinFormsApp/Presenters/MainPresenter.cs
@@ -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
{
diff --git a/src/LightQueryProfiler.WinFormsApp/Program.cs b/src/LightQueryProfiler.WinFormsApp/Program.cs
index 7e77dc2..90db50e 100644
--- a/src/LightQueryProfiler.WinFormsApp/Program.cs
+++ b/src/LightQueryProfiler.WinFormsApp/Program.cs
@@ -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();
diff --git a/src/LightQueryProfiler.WinFormsApp/Views/AboutView.Designer.cs b/src/LightQueryProfiler.WinFormsApp/Views/AboutView.Designer.cs
index d7b26e8..1e716bb 100644
--- a/src/LightQueryProfiler.WinFormsApp/Views/AboutView.Designer.cs
+++ b/src/LightQueryProfiler.WinFormsApp/Views/AboutView.Designer.cs
@@ -39,7 +39,7 @@ private void InitializeComponent()
// lblAppName
//
lblAppName.AutoSize = true;
- lblAppName.Font = new Font("Segoe UI", 18F, FontStyle.Bold, GraphicsUnit.Point);
+ lblAppName.Font = new Font("Segoe UI", 18F, FontStyle.Bold);
lblAppName.Location = new Point(66, 21);
lblAppName.Name = "lblAppName";
lblAppName.Size = new Size(241, 32);
@@ -49,7 +49,7 @@ private void InitializeComponent()
// lblVersion
//
lblVersion.AutoSize = true;
- lblVersion.Font = new Font("Segoe UI", 12F, FontStyle.Bold, GraphicsUnit.Point);
+ lblVersion.Font = new Font("Segoe UI", 12F, FontStyle.Bold);
lblVersion.Location = new Point(66, 70);
lblVersion.Name = "lblVersion";
lblVersion.Size = new Size(71, 21);
@@ -68,6 +68,7 @@ private void InitializeComponent()
//
// btnOK
//
+ btnOK.FlatStyle = FlatStyle.System;
btnOK.Location = new Point(291, 220);
btnOK.Name = "btnOK";
btnOK.Size = new Size(75, 30);
@@ -78,7 +79,7 @@ private void InitializeComponent()
// lblDescription
//
lblDescription.AutoSize = true;
- lblDescription.Font = new Font("Segoe UI", 9.75F, FontStyle.Regular, GraphicsUnit.Point);
+ lblDescription.Font = new Font("Segoe UI", 9.75F);
lblDescription.Location = new Point(47, 137);
lblDescription.Name = "lblDescription";
lblDescription.Size = new Size(278, 17);
diff --git a/src/LightQueryProfiler.WinFormsApp/Views/AboutView.cs b/src/LightQueryProfiler.WinFormsApp/Views/AboutView.cs
index 92fd547..4605691 100644
--- a/src/LightQueryProfiler.WinFormsApp/Views/AboutView.cs
+++ b/src/LightQueryProfiler.WinFormsApp/Views/AboutView.cs
@@ -1,4 +1,6 @@
-namespace LightQueryProfiler.WinFormsApp.Views
+using System.ComponentModel;
+
+namespace LightQueryProfiler.WinFormsApp.Views
{
public partial class AboutView : Form, IAboutView
{
@@ -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)
diff --git a/src/LightQueryProfiler.WinFormsApp/Views/AboutView.resx b/src/LightQueryProfiler.WinFormsApp/Views/AboutView.resx
index af32865..8b2ff64 100644
--- a/src/LightQueryProfiler.WinFormsApp/Views/AboutView.resx
+++ b/src/LightQueryProfiler.WinFormsApp/Views/AboutView.resx
@@ -1,7 +1,7 @@