Browse Source

data refactor (#27)

* Refactoring to move data access code into Infrastructure project

* Fixing namespaces
main
Steve Smith 8 years ago
committed by GitHub
parent
commit
084db74c77
  1. 2
      src/Infrastructure/Data/CatalogContext.cs
  2. 7
      src/Infrastructure/Data/CatalogContextSeed.cs
  3. 2
      src/Infrastructure/Data/Migrations/20170302162241_Initial.Designer.cs
  4. 2
      src/Infrastructure/Data/Migrations/20170302162241_Initial.cs
  5. 2
      src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs
  6. 2
      src/Infrastructure/Services/BasketService.cs
  7. 0
      src/Web/Interfaces/ICatalogService.cs
  8. 2
      src/Web/Services/CatalogService.cs
  9. 4
      src/Web/Startup.cs

2
src/Web/Infrastructure/CatalogContext.cs → src/Infrastructure/Data/CatalogContext.cs

@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.Infrastructure namespace Infrastructure.Data
{ {
public class CatalogContext : DbContext public class CatalogContext : DbContext

7
src/Web/Infrastructure/CatalogContextSeed.cs → src/Infrastructure/Data/CatalogContextSeed.cs

@ -1,7 +1,4 @@
namespace Microsoft.eShopWeb.Infrastructure using Microsoft.AspNetCore.Builder;
{
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
@ -9,6 +6,8 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Infrastructure.Data
{
public class CatalogContextSeed public class CatalogContextSeed
{ {
public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0) public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0)

2
src/Web/Infrastructure/Migrations/20170302162241_Initial.Designer.cs → src/Infrastructure/Data/Migrations/20170302162241_Initial.Designer.cs

@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Migrations namespace Infrastructure.Data.Migrations
{ {
[DbContext(typeof(CatalogContext))] [DbContext(typeof(CatalogContext))]
[Migration("20170302162241_Initial")] [Migration("20170302162241_Initial")]

2
src/Web/Infrastructure/Migrations/20170302162241_Initial.cs → src/Infrastructure/Data/Migrations/20170302162241_Initial.cs

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Migrations namespace Infrastructure.Data.Migrations
{ {
public partial class Initial : Migration public partial class Initial : Migration
{ {

2
src/Web/Infrastructure/Migrations/CatalogContextModelSnapshot.cs → src/Infrastructure/Data/Migrations/CatalogContextModelSnapshot.cs

@ -2,7 +2,7 @@
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
namespace Microsoft.eShopWeb.Infrastructure.Migrations namespace Infrastructure.Data.Migrations
{ {
[DbContext(typeof(CatalogContext))] [DbContext(typeof(CatalogContext))]
partial class CatalogContextModelSnapshot : ModelSnapshot partial class CatalogContextModelSnapshot : ModelSnapshot

2
src/Web/Services/BasketService.cs → src/Infrastructure/Services/BasketService.cs

@ -1,9 +1,9 @@
using ApplicationCore.Interfaces; using ApplicationCore.Interfaces;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.Infrastructure;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System; using System;
using Infrastructure.Data;
namespace Web.Services namespace Web.Services
{ {

0
src/Web/Services/ICatalogService.cs → src/Web/Interfaces/ICatalogService.cs

2
src/Web/Services/CatalogService.cs

@ -4,12 +4,12 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Microsoft.eShopWeb.Infrastructure;
using Microsoft.eShopWeb.ViewModels; using Microsoft.eShopWeb.ViewModels;
using Microsoft.eShopWeb.ApplicationCore.Entities; using Microsoft.eShopWeb.ApplicationCore.Entities;
using System.Data.SqlClient; using System.Data.SqlClient;
using Dapper; using Dapper;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Infrastructure.Data;
namespace Microsoft.eShopWeb.Services namespace Microsoft.eShopWeb.Services
{ {

4
src/Web/Startup.cs

@ -1,5 +1,4 @@
using Microsoft.eShopWeb.Infrastructure; using Microsoft.eShopWeb.Services;
using Microsoft.eShopWeb.Services;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
@ -17,6 +16,7 @@ using Infrastructure.Logging;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Web.Services; using Web.Services;
using ApplicationCore.Services; using ApplicationCore.Services;
using Infrastructure.Data;
namespace Microsoft.eShopWeb namespace Microsoft.eShopWeb
{ {

Loading…
Cancel
Save