-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86982ff
commit c69d193
Showing
2 changed files
with
38 additions
and
26 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/Optivem.Kata.Banking.Web/Extensions/IServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using MediatR; | ||
using Microsoft.EntityFrameworkCore; | ||
using Optivem.Kata.Banking.Core; | ||
using Optivem.Kata.Banking.Core.Domain.BankAccounts; | ||
using Optivem.Kata.Banking.Core.Domain.Time; | ||
using Optivem.Kata.Banking.Infrastructure; | ||
using Optivem.Kata.Banking.Infrastructure.Persistence; | ||
|
||
namespace Optivem.Kata.Banking.Web.Extensions | ||
{ | ||
public static class IServiceCollectionExtensions | ||
{ | ||
public static void Register(this IServiceCollection services, ConfigurationManager configuration) | ||
{ | ||
// Add services to the container. | ||
|
||
services.AddControllers(); | ||
|
||
// TODO: VC: Move to Startup to enable re-use by tests | ||
services.AddScoped<IAccountNumberGenerator, AccountNumberGenerator>(); | ||
services.AddScoped<IDateTimeService, DateTimeService>(); | ||
services.AddScoped<IBankAccountRepository, BankAccountRepository>(); | ||
|
||
services.AddDbContext<DatabaseContext>(options => | ||
{ | ||
options.UseSqlServer(configuration.GetConnectionString("BankingDatabase")); | ||
}); | ||
|
||
services.AddMediatR(typeof(CoreModule)); | ||
|
||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle | ||
services.AddEndpointsApiExplorer(); | ||
services.AddSwaggerGen(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters