zhaojs
2023-09-15 fc13938ff90213060532d99a600dea4a84456885
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
using Autofac;
using Microsoft.AspNetCore.Http;
using Operater.Service.System;
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Operater.Service
{
    public class ServiceModule : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>().PropertiesAutowired();
            var service = AppDomain.CurrentDomain.Load("Operater.Service");
 
            //builder.RegisterGeneric(typeof(BaseService<>))
            //        .As(typeof(IBaseService<>))
            //        .InstancePerLifetimeScope();
 
            builder.RegisterAssemblyTypes(service)
                //.Where(t => typeof(IDependencyInjection).IsAssignableFrom(t))
                .InstancePerLifetimeScope()
                .AsImplementedInterfaces();
        }
 
    }
}