data refactor (#27)

* Refactoring to move data access code into Infrastructure project

* Fixing namespaces
This commit is contained in:
Steve Smith
2017-08-07 10:08:41 -04:00
committed by GitHub
parent b67f8cc050
commit 084db74c77
9 changed files with 17 additions and 18 deletions

View File

@@ -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

View File

@@ -1,14 +1,13 @@
namespace Microsoft.eShopWeb.Infrastructure using Microsoft.AspNetCore.Builder;
{ using Microsoft.eShopWeb.ApplicationCore.Entities;
using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore; using System;
using Microsoft.eShopWeb.ApplicationCore.Entities; using System.Collections.Generic;
using Microsoft.Extensions.Logging; using System.Linq;
using System; using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
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)

View File

@@ -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")]

View File

@@ -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
{ {

View File

@@ -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

View File

@@ -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
{ {

View File

@@ -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
{ {

View File

@@ -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
{ {