using System;
namespace Hoa.Application.Authorization
{
public class AuthorizationAppService : IAuthorizationAppService, IAppServiceDependency
{
// 构造函数注入
private readonly ISomeAppService _someService;
public AuthorizationAppService(ISomeAppService someService)
{
_someService_ = someService;
}
}
}
using Autofac;
using Autofac.Extras.DynamicProxy;
using Hoa.Dependencies;
using Hoa.Interceptors;
using System.Linq;
namespace Hoa
{
public class HoaModule : Module
{
protected override void Load(ContainerBuilder builder)
{
var registrationBuilder = builder.RegisterAssemblyTypes(AppGlobal.ApplicationAssembiles).PublicOnly()
.Where(type => typeof(ITransientDependency).IsAssignableFrom(type))
.AsImplementedInterfaces()
.InstancePerLifetimeScope();
if (AppGlobal.AppConfigOptions.EnableGlobalPerformanceAnalysis)
{
builder.RegisterType<HoaPerformanceAnalysisInterceptor>().AsSelf();
registrationBuilder.EnableInterfaceInterceptors().InterceptedBy(typeof(HoaPerformanceAnalysisInterceptor));
}
}
}
}