private static void Main(string[] args) { bool SHOWCONSOLE = false; if (SHOWCONSOLE) { //Un-comment For Console Logging AspectServiceInjector.Initialize(new TypeCatalog(typeof(ConsoleLogger))); } else { //Un-comment For File Logging AspectServiceInjector.Initialize(new TypeCatalog(typeof(FileLogger))); } // The static constructor of LogAspect is called before the static constructor of the type // containing target methods. This is why we cannot use the aspect in the Program class. Foo.LoggedMethod(); //Pauses the app for viewing. Console.ReadLine(); }
public override void RuntimeInitialize(MethodBase method) { AspectServiceInjector.BuildObject(this); }