Skip to content

Commit

Permalink
Fixed issue "Failing to instantiate CreateCustomerCommandHandler"
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontaylordev committed Nov 2, 2018
1 parent 4c2b152 commit 930ebfc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
3 changes: 2 additions & 1 deletion Northwind.Application/Interfaces/INotificationService.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using Northwind.Application.Notifications.Models;
using System.Threading.Tasks;

namespace Northwind.Application.Interfaces
{
public interface INotificationService
{
void Send(Message message);
Task SendAsync(Message message);
}
}
5 changes: 3 additions & 2 deletions Northwind.Infrastructure/NotificationService.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using Northwind.Application.Interfaces;
using Northwind.Application.Notifications.Models;
using System.Threading.Tasks;

namespace Northwind.Infrastructure
{
public class NotificationService : INotificationService
{
public void Send(Message message)
public Task SendAsync(Message message)
{
// Do nothing
return Task.CompletedTask;
}
}
}
21 changes: 0 additions & 21 deletions Northwind.WebUI/Infrastructure/AutofacModule.cs

This file was deleted.

8 changes: 6 additions & 2 deletions Northwind.WebUI/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.AngularCli;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Northwind.Application.Customers.Commands.CreateCustomer;
using Northwind.Application.Infrastructure;
using Northwind.Application.Interfaces;
using Northwind.Application.Products.Queries.GetProduct;
using Northwind.Common;
using Northwind.Infrastructure;
using Northwind.Persistence;
using Northwind.WebUI.Filters;
using NSwag.AspNetCore;
Expand All @@ -31,6 +33,9 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddTransient<INotificationService, NotificationService>();
services.AddTransient<IDateTime, MachineDateTime>();

// Add MediatR
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestPreProcessorBehavior<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(RequestPerformanceBehaviour<,>));
Expand All @@ -41,7 +46,6 @@ public void ConfigureServices(IServiceCollection services)
services.AddDbContext<NorthwindDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("NorthwindDatabase")));


services
.AddMvc(options => options.Filters.Add(typeof(CustomExceptionFilterAttribute)))
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
Expand Down

0 comments on commit 930ebfc

Please sign in to comment.