public static IServiceProvider BuildUrdAopServiceProvider(this IServiceCollection sc, IInterceptorGenerator[] interceptors, LoomOptions options = null) { var op = options ?? LoomOptions.CreateDefault(); var userFilterProxy = op.FilterProxy ?? ((ITypeSymbolInfo i) => true); var userFilterForDefaultImplement = op.FilterForDefaultImplement ?? ((ITypeSymbolInfo i) => true); op.FilterProxy = i => i.Namespace != null && AopUtils.CanAopType(i) && userFilterProxy(i); op.FilterForDefaultImplement = i => i.Namespace != null && AopUtils.CanDoDefaultImplement(i) && userFilterForDefaultImplement(i); DestinyExtensions.CleanCache(); GC.Collect(); return(sc.BuildAopServiceProvider(null)); }
public static IServiceProvider BuildVerthandiAopServiceProvider(this IServiceCollection sc, IInterceptorGenerator[] interceptors, LoomOptions options = null) { var op = options ?? LoomOptions.CreateDefault(); var userFilterProxy = op.FilterProxy ?? ((ITypeSymbolInfo i) => true); var userFilterForDefaultImplement = op.FilterForDefaultImplement ?? ((ITypeSymbolInfo i) => true); op.FilterProxy = i => i.Namespace != null && AopUtils.CanAopType(i) && userFilterProxy(i); op.FilterForDefaultImplement = i => i.Namespace != null && AopUtils.CanDoDefaultImplement(i) && userFilterForDefaultImplement(i); var generator = new AopSourceGenerator(op, interceptors ?? new IInterceptorGenerator[0]); var types = sc.Select(i => i.ServiceType).Select(j => j.IsGenericType ? j.GetGenericTypeDefinition() : j).Distinct().ToArray(); var assembly = generator.Generate(new TypesSymbolSource(types)); DestinyExtensions.CleanCache(); GC.Collect(); return(sc.BuildAopServiceProvider(assembly)); }
public AopSourceGenerator(LoomOptions options, IEnumerable <IInterceptorGenerator> generators) { this.options = options; this.generators = generators.ToArray(); }
public OnlyDefaultImplementNotationGenerator(LoomOptions options, IEnumerable <IInterceptorGenerator> generators) : base(options, generators) { }
public static IHostBuilder UseUrdAop(this IHostBuilder builder, IInterceptorGenerator[] interceptors, LoomOptions options = null) { return(builder.UseServiceProviderFactory(new UrdServiceProviderFactory() { Options = options, Interceptors = interceptors })); }