From dd530c02a99b73c551f7d30286a60ec177a30a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Sun, 10 Jan 2021 12:34:59 +0100 Subject: [PATCH] Project restructured --- RepositoryPattern.sln | 6 ++++++ RepositoryPattern/Program.cs | 1 + RepositoryPattern/RepositoryPattern.csproj | 3 ++- StockDal.Interface/StockDal.Interface.csproj | 4 ++++ .../AppConnection.cs | 0 .../ProductRepository.cs | 16 +++++++--------- StockDal/StockDal.csproj | 17 +++++++++++++++++ 7 files changed, 37 insertions(+), 10 deletions(-) rename {RepositoryPattern => StockDal}/AppConnection.cs (100%) rename {RepositoryPattern => StockDal}/ProductRepository.cs (80%) create mode 100644 StockDal/StockDal.csproj diff --git a/RepositoryPattern.sln b/RepositoryPattern.sln index 61fc2b8..acb1d81 100644 --- a/RepositoryPattern.sln +++ b/RepositoryPattern.sln @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StockDomain", "StockDomain\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StockDal.Interface", "StockDal.Interface\StockDal.Interface.csproj", "{65F33E97-16CF-471A-9C59-D0D17287856C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StockDal", "StockDal\StockDal.csproj", "{E3C410EE-5040-48E1-9C87-DC9A0D011DC7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,10 @@ Global {65F33E97-16CF-471A-9C59-D0D17287856C}.Debug|Any CPU.Build.0 = Debug|Any CPU {65F33E97-16CF-471A-9C59-D0D17287856C}.Release|Any CPU.ActiveCfg = Release|Any CPU {65F33E97-16CF-471A-9C59-D0D17287856C}.Release|Any CPU.Build.0 = Release|Any CPU + {E3C410EE-5040-48E1-9C87-DC9A0D011DC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3C410EE-5040-48E1-9C87-DC9A0D011DC7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3C410EE-5040-48E1-9C87-DC9A0D011DC7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3C410EE-5040-48E1-9C87-DC9A0D011DC7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/RepositoryPattern/Program.cs b/RepositoryPattern/Program.cs index e8cc362..89f86a1 100644 --- a/RepositoryPattern/Program.cs +++ b/RepositoryPattern/Program.cs @@ -1,4 +1,5 @@ using Autofac; +using StockDal; using StockDal.Interface; using System; using System.Collections.Generic; diff --git a/RepositoryPattern/RepositoryPattern.csproj b/RepositoryPattern/RepositoryPattern.csproj index 69f5fd5..bd1e299 100644 --- a/RepositoryPattern/RepositoryPattern.csproj +++ b/RepositoryPattern/RepositoryPattern.csproj @@ -1,4 +1,4 @@ - + WinExe @@ -14,6 +14,7 @@ + diff --git a/StockDal.Interface/StockDal.Interface.csproj b/StockDal.Interface/StockDal.Interface.csproj index 41382c5..be2c747 100644 --- a/StockDal.Interface/StockDal.Interface.csproj +++ b/StockDal.Interface/StockDal.Interface.csproj @@ -4,6 +4,10 @@ netcoreapp3.1 + + + + diff --git a/RepositoryPattern/AppConnection.cs b/StockDal/AppConnection.cs similarity index 100% rename from RepositoryPattern/AppConnection.cs rename to StockDal/AppConnection.cs diff --git a/RepositoryPattern/ProductRepository.cs b/StockDal/ProductRepository.cs similarity index 80% rename from RepositoryPattern/ProductRepository.cs rename to StockDal/ProductRepository.cs index 9c1bdf5..9095c7b 100644 --- a/RepositoryPattern/ProductRepository.cs +++ b/StockDal/ProductRepository.cs @@ -1,15 +1,13 @@ -using System; +using Dapper; +using RepositoryPattern; +using StockDal.Interface; +using StockDomain; +using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Dapper; -using StockDal.Interface; -using StockDomain; -namespace RepositoryPattern +namespace StockDal { public class ProductRepository : IProductRepository { @@ -20,7 +18,7 @@ namespace RepositoryPattern public IEnumerable GetProducts() { - using IDbConnection db = new SqlConnection(AppConnection.ConnectionString); + using System.Data.IDbConnection db = new SqlConnection(AppConnection.ConnectionString); if (db.State == ConnectionState.Closed) db.Open(); return db.Query("select ProductId, ProductName, UnitPrice, UnitsInStock ,RIGHT('00000' + cast(ProductId as varchar) , 5) As Barcode from Products", commandType: CommandType.Text); diff --git a/StockDal/StockDal.csproj b/StockDal/StockDal.csproj new file mode 100644 index 0000000..eb8c9b7 --- /dev/null +++ b/StockDal/StockDal.csproj @@ -0,0 +1,17 @@ + + + + netcoreapp3.1 + + + + + + + + + + + + +