From a23d8792622e5ddbcca8c949877b9dd80981a540 Mon Sep 17 00:00:00 2001 From: biproberkay Date: Fri, 1 Oct 2021 01:21:57 +0300 Subject: [PATCH] added: forgotten tansaction, connectionstring deleted: unneccessary usings --- .gitignore | 1 + DapperUnitOfWork.Console/Program.cs | 6 +++--- DapperUnitOfWork/DapperUnitOfWork.csproj | 1 - DapperUnitOfWork/Repositories/CatRepository.cs | 3 ++- DapperUnitOfWork/UnitOfWork.cs | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 1bc915c..fd03f90 100644 --- a/.gitignore +++ b/.gitignore @@ -154,3 +154,4 @@ $RECYCLE.BIN/ # Mac desktop service store files .DS_Store +/packages/Dapper.1.42 diff --git a/DapperUnitOfWork.Console/Program.cs b/DapperUnitOfWork.Console/Program.cs index b76f15b..db2f04b 100644 --- a/DapperUnitOfWork.Console/Program.cs +++ b/DapperUnitOfWork.Console/Program.cs @@ -4,9 +4,9 @@ They have never in any way contributed to this code, and the false attribution has been reported to StackOverflow. */ -using DapperUnitOfWork.Data; -using DapperUnitOfWork.Domain; -using DapperUnitOfWork.Domain.Entities; +//using DapperUnitOfWork.Data; +//using DapperUnitOfWork.Domain; +//using DapperUnitOfWork.Domain.Entities; using DapperUnitOfWork.Entities; using System; using System.Collections.Generic; diff --git a/DapperUnitOfWork/DapperUnitOfWork.csproj b/DapperUnitOfWork/DapperUnitOfWork.csproj index ae66679..af8a5d3 100644 --- a/DapperUnitOfWork/DapperUnitOfWork.csproj +++ b/DapperUnitOfWork/DapperUnitOfWork.csproj @@ -32,7 +32,6 @@ ..\packages\Dapper.1.42\lib\net45\Dapper.dll - True diff --git a/DapperUnitOfWork/Repositories/CatRepository.cs b/DapperUnitOfWork/Repositories/CatRepository.cs index 8053ba7..adeb2e1 100644 --- a/DapperUnitOfWork/Repositories/CatRepository.cs +++ b/DapperUnitOfWork/Repositories/CatRepository.cs @@ -17,7 +17,8 @@ public CatRepository(IDbTransaction transaction) public IEnumerable All() { return Connection.Query( - "SELECT * FROM Cat" + "SELECT * FROM Cat", + transaction:Transaction ); } diff --git a/DapperUnitOfWork/UnitOfWork.cs b/DapperUnitOfWork/UnitOfWork.cs index 9d6bae9..bfa0d81 100644 --- a/DapperUnitOfWork/UnitOfWork.cs +++ b/DapperUnitOfWork/UnitOfWork.cs @@ -21,6 +21,7 @@ public class UnitOfWork : IUnitOfWork public UnitOfWork(string connectionString) { + connectionString = "Server=(localdb)\\MSSQLLocalDb;Database=LosGatos;User Id=LosGatosUser;Password=Password123;"; _connection = new SqlConnection(connectionString); _connection.Open(); _transaction = _connection.BeginTransaction();