private static void MixinAndInterceptorExecution() { Console.Out.WriteLine( " o0o Within security checking o0o " ); // For the sake of readability we're keep the aspect code here: String contents = " import AspectSharp.Example.Aop.Interceptors " + " import AspectSharp.Example.Aop.Mixins " + " " + " aspect sample for [ AspectSharp.Example.ContentProviders ] " + " include SecurityMixin " + " " + " pointcut method(* RetrieveContent())" + " advice(SecurityCheckInterceptor)" + " end" + " " + " end "; AspectLanguageEngineBuilder builder = new AspectLanguageEngineBuilder( contents ); AspectEngine engine = builder.Build(); RequestPipeline pipeline = new RequestPipeline(); pipeline.Context["username"] = "******"; pipeline.AddContentProvider( engine.WrapClass( typeof(StaticContentProvider) ) as IContentProvider ); pipeline.AddContentProvider( engine.WrapClass( typeof(DynamicContentProvider) ) as IContentProvider ); pipeline.View = new PlainTextView(); pipeline.ProcessRequest( Console.Out ); Console.Out.WriteLine(); }
private static void SimpleExecution() { Console.Out.WriteLine( " o0o First execution o0o " ); RequestPipeline pipeline = new RequestPipeline(); pipeline.Context["username"] = "******"; pipeline.AddContentProvider( new StaticContentProvider() ); pipeline.AddContentProvider( new DynamicContentProvider() ); pipeline.View = new PlainTextView(); pipeline.ProcessRequest( Console.Out ); Console.Out.WriteLine(); }