public static IFluentAspectsBuilder AddFluentAspects(this IServiceCollection serviceCollection, Action <FluentAspectOptions> optionsAction)
 {
     if (null == serviceCollection)
     {
         throw new ArgumentNullException(nameof(serviceCollection));
     }
     if (null == optionsAction)
     {
         throw new ArgumentNullException(nameof(optionsAction));
     }
     FluentAspects.Configure(optionsAction);
     return(AddFluentAspects(serviceCollection));
 }
Beispiel #2
0
        public static void MainTest()
        {
            FluentAspects.Configure(options =>
            {
                options.InterceptMethod <IFly>(f => f.Fly())
                .With <LogInterceptor>();
                options.NoInterceptPropertyGetter <IFly>(f => f.Name);

                // options.UseInterceptorResolver<AttributeInterceptorResolver>();
            });
            //
            var fly = FluentAspects.CreateProxy <IFly, MonkeyKing>();

            Console.WriteLine(fly.Name);
            fly.Fly();
        }