Refactor user entities and repositories, update seeders

Standardized property naming in user-related entities to use 'Id' suffix (e.g., UserAccountId). Moved and updated repository interfaces and implementations to the DataAccessLayer.Repositories namespace. Refactored DBSeed seeders to use repository classes and improved structure. Updated .gitignore and project references
This commit is contained in:
Aaron Po
2026-01-15 13:23:41 -05:00
parent 60ef65ec52
commit b8cd855916
16 changed files with 660 additions and 760 deletions

View File

@@ -4,45 +4,31 @@ using Microsoft.Data.SqlClient;
namespace DataAccessLayer.Sql
{
public class DatabaseHelper
public class DatabaseHelper(string connectionString)
{
private readonly string _connectionString;
public DatabaseHelper(string connectionString)
{
_connectionString = connectionString;
}
public void ExecuteRawSql(string query)
{
try
{
using (
SqlConnection connection = new SqlConnection(
_connectionString
)
)
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())
{
connection.Open();
using (
SqlCommand command = new SqlCommand(query, connection)
)
for (var i = 0; i < reader.FieldCount; i++)
{
command.CommandType = CommandType.Text;
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
for (int i = 0; i < reader.FieldCount; i++)
{
Console.WriteLine(
$"{reader.GetName(i)}: {reader.GetValue(i)}"
);
}
}
}
Console.WriteLine(
$"{reader.GetName(i)}: {reader.GetValue(i)}"
);
}
}
}