From 1b66c3dd0c1edd0dc56ab68d047df0e428b13468 Mon Sep 17 00:00:00 2001 From: Jason Zhu Date: Fri, 20 Aug 2021 23:58:19 +1000 Subject: [PATCH] 7.4.4 Creating the Entity Framework Context; e.g. 7.10 The EfDbContext Class --- SportsStore/SportsStore.Domain/App.config | 12 +++++++++++ .../Concrete/EFDbContext.cs | 15 +++++++++++++ .../SportsStore.Domain.csproj | 21 +++++++++++++++++++ .../SportsStore.Domain/packages.config | 1 + 4 files changed, 49 insertions(+) create mode 100644 SportsStore/SportsStore.Domain/App.config create mode 100644 SportsStore/SportsStore.Domain/Concrete/EFDbContext.cs diff --git a/SportsStore/SportsStore.Domain/App.config b/SportsStore/SportsStore.Domain/App.config new file mode 100644 index 0000000..2af6916 --- /dev/null +++ b/SportsStore/SportsStore.Domain/App.config @@ -0,0 +1,12 @@ + + + + +
+ + + + + + + \ No newline at end of file diff --git a/SportsStore/SportsStore.Domain/Concrete/EFDbContext.cs b/SportsStore/SportsStore.Domain/Concrete/EFDbContext.cs new file mode 100644 index 0000000..d70a1ea --- /dev/null +++ b/SportsStore/SportsStore.Domain/Concrete/EFDbContext.cs @@ -0,0 +1,15 @@ +using SportsStore.Domain.Entities; +using System; +using System.Collections.Generic; +using System.Data.Entity; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SportsStore.Domain.Concrete +{ + class EFDbContext : DbContext + { + public DbSet Products { get; set; } + } +} diff --git a/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj b/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj index 2b6aef9..9616722 100644 --- a/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj +++ b/SportsStore/SportsStore.Domain/SportsStore.Domain.csproj @@ -1,5 +1,6 @@  + Debug @@ -12,6 +13,8 @@ v4.8 512 true + + true @@ -34,6 +37,12 @@ ..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll + + ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll + ..\packages\Moq.4.16.1\lib\net45\Moq.dll @@ -41,6 +50,7 @@ ..\packages\Ninject.3.3.4\lib\net45\Ninject.dll + @@ -59,11 +69,22 @@ + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/SportsStore/SportsStore.Domain/packages.config b/SportsStore/SportsStore.Domain/packages.config index 33cb799..47e1d94 100644 --- a/SportsStore/SportsStore.Domain/packages.config +++ b/SportsStore/SportsStore.Domain/packages.config @@ -1,6 +1,7 @@  +