-
Notifications
You must be signed in to change notification settings - Fork 11
/
AutofacBusinessModule.cs
58 lines (45 loc) · 2.42 KB
/
AutofacBusinessModule.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using Autofac;
using Autofac.Extras.DynamicProxy;
using Business.Abstract;
using Business.Concrete;
using Castle.DynamicProxy;
using Core.Utilities.Interceptors;
using Core.Utilities.Security.JWT;
using DataAccess.Abstract;
using DataAccess.Concrete.EntityFramework.Repository;
using System;
using System.Collections.Generic;
using System.Text;
namespace Business.DependencyResolvers.Autofac
{
public class AutofacBusinessModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<CarManager>().As<ICarService>().SingleInstance();
builder.RegisterType<EfCarDal>().As<ICarDal>().SingleInstance();
builder.RegisterType<BrandManager>().As<IBrandService>().SingleInstance();
builder.RegisterType<EfBrandDal>().As<IBrandDal>().SingleInstance();
builder.RegisterType<ColorManager>().As<IColorService>().SingleInstance();
builder.RegisterType<EfColorDal>().As<IColorDal>().SingleInstance();
builder.RegisterType<CustomerManager>().As<ICustomerService>().SingleInstance();
builder.RegisterType<EfCustomerDal>().As<ICustomerDal>().SingleInstance();
builder.RegisterType<RentalManager>().As<IRentalService>().SingleInstance();
builder.RegisterType<EfRentalDal>().As<IRentalDal>().SingleInstance();
builder.RegisterType<UserManager>().As<IUserService>().SingleInstance();
builder.RegisterType<EfUserDal>().As<IUserDal>().SingleInstance();
builder.RegisterType<CarImageManager>().As<ICarImageService>().SingleInstance();
builder.RegisterType<EfCarImageDal>().As<ICarImageDal>().SingleInstance();
builder.RegisterType<CreditCardManager>().As<ICreditCardService>().SingleInstance();
builder.RegisterType<EfCreditCardDal>().As<ICreditCardDal>().SingleInstance();
builder.RegisterType<AuthManager>().As<IAuthService>();
builder.RegisterType<JwtHelper>().As<ITokenHelper>();
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
builder.RegisterAssemblyTypes(assembly).AsImplementedInterfaces()
.EnableInterfaceInterceptors(new ProxyGenerationOptions()
{
Selector = new AspectInterceptorSelector()
}).SingleInstance();
}
}
}