Minor refactoring and Unit Test fix
This commit is contained in:
parent
92cd474d34
commit
fa6a273a33
@ -48,11 +48,13 @@
|
||||
}).AddControllersAsServices();
|
||||
|
||||
services.AddEntityFrameworkSqlServer()
|
||||
.AddDbContext<OrderingContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(Configuration["ConnectionString"],
|
||||
sqlop => sqlop.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name));
|
||||
});
|
||||
.AddDbContext<OrderingContext>(options =>
|
||||
{
|
||||
options.UseSqlServer(Configuration["ConnectionString"],
|
||||
sqlop => sqlop.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name));
|
||||
},
|
||||
ServiceLifetime.Scoped
|
||||
);
|
||||
|
||||
services.AddSwaggerGen();
|
||||
services.ConfigureSwaggerGen(options =>
|
||||
|
@ -13,6 +13,14 @@
|
||||
{
|
||||
private readonly OrderingContext _context;
|
||||
|
||||
public IUnitOfWork UnitOfWork
|
||||
{
|
||||
get
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
}
|
||||
|
||||
public BuyerRepository(OrderingContext context)
|
||||
{
|
||||
if (context == null)
|
||||
@ -23,14 +31,6 @@
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public IUnitOfWork UnitOfWork
|
||||
{
|
||||
get
|
||||
{
|
||||
return _context;
|
||||
}
|
||||
}
|
||||
|
||||
public Buyer Add(Buyer buyer)
|
||||
{
|
||||
return _context.Buyers
|
||||
|
@ -2,7 +2,8 @@
|
||||
{
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Api.Application.Commands;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Repositories;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
|
||||
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
Loading…
x
Reference in New Issue
Block a user