Update repository, seed and service layers

This commit is contained in:
Aaron Po
2026-01-15 14:48:18 -05:00
parent b8cd855916
commit c5aaf8cd05
15 changed files with 322 additions and 412 deletions

View File

@@ -1,41 +0,0 @@
using System;
using System.Data;
using Microsoft.Data.SqlClient;
namespace DataAccessLayer.Sql
{
public class DatabaseHelper(string connectionString)
{
public void ExecuteRawSql(string query)
{
try
{
using var connection = new SqlConnection(
connectionString
);
connection.Open();
using var command = new SqlCommand(query, connection);
command.CommandType = CommandType.Text;
using var reader = command.ExecuteReader();
while (reader.Read())
{
for (var i = 0; i < reader.FieldCount; i++)
{
Console.WriteLine(
$"{reader.GetName(i)}: {reader.GetValue(i)}"
);
}
}
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
}
}

View File

@@ -0,0 +1,9 @@
using Microsoft.Data.SqlClient;
namespace DataAccessLayer.Sql
{
public interface ISqlConnectionFactory
{
SqlConnection CreateConnection();
}
}