Skip to content

Commit

Permalink
Upgrading to MediatR 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogard committed Dec 3, 2017
1 parent 49bf2fe commit 4c0183e
Show file tree
Hide file tree
Showing 22 changed files with 81 additions and 81 deletions.
34 changes: 17 additions & 17 deletions src/ContosoUniversityCore/ContosoUniversityCore.csproj
Expand Up @@ -23,31 +23,31 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="AutoMapper" Version="6.1.1" />
<PackageReference Include="AutoMapper.EF6" Version="1.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="3.0.1" />
<PackageReference Include="BundlerMinifier.Core" Version="2.4.337" />
<PackageReference Include="AutoMapper" Version="6.2.1" />
<PackageReference Include="AutoMapper.EF6" Version="1.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="3.2.0" />
<PackageReference Include="BundlerMinifier.Core" Version="2.6.362" />
<PackageReference Include="DelegateDecompiler.EntityFramework" Version="0.23.0" />
<PackageReference Include="EntityFramework" Version="6.1.3" />
<PackageReference Include="EntityFramework" Version="6.2.0" />
<PackageReference Include="EntityFramework.Extended" Version="6.1.0.168" />
<PackageReference Include="FluentValidation.AspNetCore" Version="7.1.1" />
<PackageReference Include="HtmlTags.AspNetCore" Version="5.0.0" />
<PackageReference Include="MediatR" Version="3.0.1" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="7.3.0-beta2" />
<PackageReference Include="HtmlTags.AspNetCore" Version="6.0.0" />
<PackageReference Include="MediatR" Version="4.0.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="4.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.0.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.0" />
<PackageReference Include="OdeToCode.AddFeatureFolders" Version="1.0.4" />
<PackageReference Include="X.PagedList" Version="7.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.0.1" />
<PackageReference Include="OdeToCode.AddFeatureFolders" Version="1.0.8" />
<PackageReference Include="X.PagedList" Version="7.1.7" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
Expand Down
4 changes: 2 additions & 2 deletions src/ContosoUniversityCore/Features/Course/Create.cs
Expand Up @@ -17,7 +17,7 @@ public class Command : IRequest
public Department Department { get; set; }
}

public class Handler : IRequestHandler<Command>
public class Handler : RequestHandler<Command>
{
private readonly SchoolContext _db;

Expand All @@ -26,7 +26,7 @@ public Handler(SchoolContext db)
_db = db;
}

public void Handle(Command message)
protected override void HandleCore(Command message)
{
var course = Mapper.Map<Command, Course>(message);
course.Id = message.Number;
Expand Down
8 changes: 4 additions & 4 deletions src/ContosoUniversityCore/Features/Course/Delete.cs
Expand Up @@ -23,7 +23,7 @@ public QueryValidator()
}
}

public class QueryHandler : IAsyncRequestHandler<Query, Command>
public class QueryHandler : AsyncRequestHandler<Query, Command>
{
private readonly SchoolContext _db;

Expand All @@ -32,7 +32,7 @@ public QueryHandler(SchoolContext db)
_db = db;
}

public Task<Command> Handle(Query message)
protected override Task<Command> HandleCore(Query message)
{
return _db.Courses.Where(c => c.Id == message.Id).ProjectToSingleOrDefaultAsync<Command>();
}
Expand All @@ -47,7 +47,7 @@ public class Command : IRequest
public string DepartmentName { get; set; }
}

public class CommandHandler : IAsyncRequestHandler<Command>
public class CommandHandler : AsyncRequestHandler<Command>
{
private readonly SchoolContext _db;

Expand All @@ -56,7 +56,7 @@ public CommandHandler(SchoolContext db)
_db = db;
}

public async Task Handle(Command message)
protected override async Task HandleCore(Command message)
{
var course = await _db.Courses.FindAsync(message.Id);

Expand Down
4 changes: 2 additions & 2 deletions src/ContosoUniversityCore/Features/Course/Details.cs
Expand Up @@ -30,7 +30,7 @@ public class Model
public string DepartmentName { get; set; }
}

public class Handler : IAsyncRequestHandler<Query, Model>
public class Handler : AsyncRequestHandler<Query, Model>
{
private readonly SchoolContext _db;

Expand All @@ -39,7 +39,7 @@ public Handler(SchoolContext db)
_db = db;
}

public Task<Model> Handle(Query message)
protected override Task<Model> HandleCore(Query message)
{
return _db.Courses.Where(i => i.Id == message.Id).ProjectToSingleOrDefaultAsync<Model>();
}
Expand Down
8 changes: 4 additions & 4 deletions src/ContosoUniversityCore/Features/Course/Edit.cs
Expand Up @@ -24,7 +24,7 @@ public QueryValidator()
}
}

public class QueryHandler : IAsyncRequestHandler<Query, Command>
public class QueryHandler : AsyncRequestHandler<Query, Command>
{
private readonly SchoolContext _db;

Expand All @@ -33,7 +33,7 @@ public QueryHandler(SchoolContext db)
_db = db;
}

public Task<Command> Handle(Query message)
protected override Task<Command> HandleCore(Query message)
{
return _db.Courses.Where(c => c.Id == message.Id).ProjectToSingleOrDefaultAsync<Command>();
}
Expand All @@ -57,7 +57,7 @@ public CommandValidator()
}
}

public class CommandHandler : IAsyncRequestHandler<Command>
public class CommandHandler : AsyncRequestHandler<Command>
{
private readonly SchoolContext _db;

Expand All @@ -66,7 +66,7 @@ public CommandHandler(SchoolContext db)
_db = db;
}

public async Task Handle(Command message)
protected override async Task HandleCore(Command message)
{
var course = await _db.Courses.FindAsync(message.Id);

Expand Down
4 changes: 2 additions & 2 deletions src/ContosoUniversityCore/Features/Course/Index.cs
Expand Up @@ -29,7 +29,7 @@ public class Course
}
}

public class Handler : IAsyncRequestHandler<Query, Result>
public class Handler : AsyncRequestHandler<Query, Result>
{
private readonly SchoolContext _db;

Expand All @@ -38,7 +38,7 @@ public Handler(SchoolContext db)
_db = db;
}

public async Task<Result> Handle(Query message)
protected override async Task<Result> HandleCore(Query message)
{
int? departmentID = message.SelectedDepartment?.Id;

Expand Down
4 changes: 2 additions & 2 deletions src/ContosoUniversityCore/Features/Department/Create.cs
Expand Up @@ -38,7 +38,7 @@ public class Command : IRequest
public Instructor Administrator { get; set; }
}

public class CommandHandler : IRequestHandler<Command>
public class CommandHandler : RequestHandler<Command>
{
private readonly SchoolContext _context;

Expand All @@ -47,7 +47,7 @@ public CommandHandler(SchoolContext context)
_context = context;
}

public void Handle(Command message)
protected override void HandleCore(Command message)
{
var department = Mapper.Map<Command, Department>(message);

Expand Down
8 changes: 4 additions & 4 deletions src/ContosoUniversityCore/Features/Department/Delete.cs
Expand Up @@ -31,7 +31,7 @@ public class Command : IRequest
public byte[] RowVersion { get; set; }
}

public class QueryHandler : IAsyncRequestHandler<Query, Command>
public class QueryHandler : AsyncRequestHandler<Query, Command>
{
private readonly SchoolContext _db;

Expand All @@ -40,7 +40,7 @@ public QueryHandler(SchoolContext db)
_db = db;
}

public async Task<Command> Handle(Query message)
protected override async Task<Command> HandleCore(Query message)
{
var department = await _db.Departments
.Where(d => d.Id == message.Id)
Expand All @@ -50,7 +50,7 @@ public async Task<Command> Handle(Query message)
}
}

public class CommandHandler : IAsyncRequestHandler<Command>
public class CommandHandler : AsyncRequestHandler<Command>
{
private readonly SchoolContext _db;

Expand All @@ -59,7 +59,7 @@ public CommandHandler(SchoolContext db)
_db = db;
}

public async Task Handle(Command message)
protected override async Task HandleCore(Command message)
{
var department = await _db.Departments.FindAsync(message.Id);

Expand Down
4 changes: 2 additions & 2 deletions src/ContosoUniversityCore/Features/Department/Details.cs
Expand Up @@ -28,7 +28,7 @@ public class Model

}

public class QueryHandler : IAsyncRequestHandler<Query, Model>
public class QueryHandler : AsyncRequestHandler<Query, Model>
{
private readonly SchoolContext _context;

Expand All @@ -37,7 +37,7 @@ public QueryHandler(SchoolContext context)
_context = context;
}

public async Task<Model> Handle(Query message)
protected override async Task<Model> HandleCore(Query message)
{
string query = @"
SELECT d.*, p.LastName + ', ' + p.FirstName AS [AdministratorFullName]
Expand Down
8 changes: 4 additions & 4 deletions src/ContosoUniversityCore/Features/Department/Edit.cs
Expand Up @@ -40,7 +40,7 @@ public Validator()
}
}

public class QueryHandler : IAsyncRequestHandler<Query, Command>
public class QueryHandler : AsyncRequestHandler<Query, Command>
{
private readonly SchoolContext _db;

Expand All @@ -49,7 +49,7 @@ public QueryHandler(SchoolContext db)
_db = db;
}

public async Task<Command> Handle(Query message)
protected override async Task<Command> HandleCore(Query message)
{
var department = await _db.Departments
.Where(d => d.Id == message.Id)
Expand All @@ -59,7 +59,7 @@ public async Task<Command> Handle(Query message)
}
}

public class CommandHandler : IAsyncRequestHandler<Command>
public class CommandHandler : AsyncRequestHandler<Command>
{
private readonly SchoolContext _db;

Expand All @@ -68,7 +68,7 @@ public CommandHandler(SchoolContext db)
_db = db;
}

public async Task Handle(Command message)
protected override async Task HandleCore(Command message)
{
var dept = await _db.Departments.FindAsync(message.Id);
message.Administrator = await _db.Instructors.FindAsync(message.Administrator.Id);
Expand Down
4 changes: 2 additions & 2 deletions src/ContosoUniversityCore/Features/Department/Index.cs
Expand Up @@ -28,7 +28,7 @@ public class Model
public string AdministratorFullName { get; set; }
}

public class QueryHandler : IAsyncRequestHandler<Query, List<Model>>
public class QueryHandler : AsyncRequestHandler<Query, List<Model>>
{
private readonly SchoolContext _context;

Expand All @@ -37,7 +37,7 @@ public QueryHandler(SchoolContext context)
_context = context;
}

public async Task<List<Model>> Handle(Query message)
protected override async Task<List<Model>> HandleCore(Query message)
{
return await _context.Departments
.ProjectToListAsync<Model>();
Expand Down
8 changes: 4 additions & 4 deletions src/ContosoUniversityCore/Features/Instructor/CreateEdit.cs
Expand Up @@ -79,7 +79,7 @@ public CommandValidator()
}
}

public class QueryHandler : IAsyncRequestHandler<Query, Command>
public class QueryHandler : AsyncRequestHandler<Query, Command>
{
private readonly SchoolContext _db;

Expand All @@ -88,7 +88,7 @@ public QueryHandler(SchoolContext db)
_db = db;
}

public async Task<Command> Handle(Query message)
protected override async Task<Command> HandleCore(Query message)
{
Command model;
if (message.Id == null)
Expand Down Expand Up @@ -122,7 +122,7 @@ private void PopulateAssignedCourseData(Command model)

}

public class CommandHandler : IAsyncRequestHandler<Command, int>
public class CommandHandler : AsyncRequestHandler<Command, int>
{
private readonly SchoolContext _db;

Expand All @@ -131,7 +131,7 @@ public CommandHandler(SchoolContext db)
_db = db;
}

public async Task<int> Handle(Command message)
protected override async Task<int> HandleCore(Command message)
{
Instructor instructor;
if (message.Id == null)
Expand Down
8 changes: 4 additions & 4 deletions src/ContosoUniversityCore/Features/Instructor/Delete.cs
Expand Up @@ -41,7 +41,7 @@ public class Command : IRequest
public string OfficeAssignmentLocation { get; set; }
}

public class QueryHandler : IAsyncRequestHandler<Query, Command>
public class QueryHandler : AsyncRequestHandler<Query, Command>
{
private readonly SchoolContext _db;

Expand All @@ -50,13 +50,13 @@ public QueryHandler(SchoolContext db)
_db = db;
}

public Task<Command> Handle(Query message)
protected override Task<Command> HandleCore(Query message)
{
return _db.Instructors.Where(i => i.Id == message.Id).ProjectToSingleOrDefaultAsync<Command>();
}
}

public class CommandHandler : IAsyncRequestHandler<Command>
public class CommandHandler : AsyncRequestHandler<Command>
{
private readonly SchoolContext _db;

Expand All @@ -65,7 +65,7 @@ public CommandHandler(SchoolContext db)
_db = db;
}

public async Task Handle(Command message)
protected override async Task HandleCore(Command message)
{
Instructor instructor = await _db.Instructors
.Include(i => i.OfficeAssignment)
Expand Down
4 changes: 2 additions & 2 deletions src/ContosoUniversityCore/Features/Instructor/Details.cs
Expand Up @@ -39,7 +39,7 @@ public class Model
public string OfficeAssignmentLocation { get; set; }
}

public class Handler : IAsyncRequestHandler<Query, Model>
public class Handler : AsyncRequestHandler<Query, Model>
{
private readonly SchoolContext _db;

Expand All @@ -48,7 +48,7 @@ public Handler(SchoolContext db)
_db = db;
}

public Task<Model> Handle(Query message)
protected override Task<Model> HandleCore(Query message)
{
return _db.Instructors.Where(i => i.Id == message.Id).ProjectToSingleOrDefaultAsync<Model>();
}
Expand Down

0 comments on commit 4c0183e

Please sign in to comment.