-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBootstrap.cs
39 lines (34 loc) · 1.25 KB
/
Bootstrap.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using WebApplication1.App;
using WebApplication1.App.Web;
namespace WebApplication1;
public static class Bootstrap
{
public static IServiceCollection AddServices(this IServiceCollection services)
{
services
.AddHttpContextAccessor()
.AddTransient<IGreeter, PoliteGreeter>()
// .AddTransient<IUseCase<PersonToGreet>, GreetUseCase>()
.AddTransient<IGreetUseCase, GreetUseCase>()
.AddTransient<IPresenter<Greeting>, GreetingPresenterHttp>()
;
// var useCaseAssembly = typeof(IUseCase<>).Assembly;
//
// var registrations = (
// // from type in repositoryAssembly.GetTypes()
// from type in useCaseAssembly.GetExportedTypes()
// //where type.Namespace.StartsWith("MyComp.MyProd.DAL")
// from service in type.GetInterfaces()
// // where service.GetGenericTypeDefinition()==typ
// select new { service, implementation = type }
// ).ToArray();
//
// foreach (var reg in registrations)
// {
// services.AddTransient(reg.service, reg.implementation);
// }
return services;
}
}