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. 19
      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.eShopWeb.ApplicationCore.Entities;
namespace Microsoft.eShopWeb.Infrastructure
namespace Infrastructure.Data
{
public class CatalogContext : DbContext

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

@ -1,14 +1,13 @@
namespace Microsoft.eShopWeb.Infrastructure
{
using Microsoft.AspNetCore.Builder;
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Infrastructure.Data
{
public class CatalogContextSeed
{
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.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Migrations
namespace Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
[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 Microsoft.EntityFrameworkCore.Migrations;
namespace Microsoft.eShopWeb.Infrastructure.Migrations
namespace Infrastructure.Data.Migrations
{
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.Metadata;
namespace Microsoft.eShopWeb.Infrastructure.Migrations
namespace Infrastructure.Data.Migrations
{
[DbContext(typeof(CatalogContext))]
partial class CatalogContextModelSnapshot : ModelSnapshot

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

@ -1,9 +1,9 @@
using ApplicationCore.Interfaces;
using System.Threading.Tasks;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.eShopWeb.Infrastructure;
using Microsoft.EntityFrameworkCore;
using System;
using Infrastructure.Data;
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.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using Microsoft.eShopWeb.Infrastructure;
using Microsoft.eShopWeb.ViewModels;
using Microsoft.eShopWeb.ApplicationCore.Entities;
using System.Data.SqlClient;
using Dapper;
using Microsoft.Extensions.Logging;
using Infrastructure.Data;
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.Hosting;
using Microsoft.EntityFrameworkCore;
@ -17,6 +16,7 @@ using Infrastructure.Logging;
using Microsoft.AspNetCore.Identity;
using Web.Services;
using ApplicationCore.Services;
using Infrastructure.Data;
namespace Microsoft.eShopWeb
{

Loading…
Cancel
Save