示例#1
0
        private void TestLogAspect(ISomething something,
                                   Record record)
        {
            m_Bus.SubscribeAsync <StatusMessage>(GetType().FullName,
                                                 StatusHandler);

            something.DoSomething("");
            m_Logger.Debug("Augment 10 returns {0}".Inject(something.Augment(10)));
            something.DoSomething(record);
        }
示例#2
0
        public void Main()
        {
            var something = m_Container.Resolve <ISomething>();
            var record = new Record(1.0,
                                    2.0,
                                    "Hello World",
                                    3.0);

            TestLogAspect(something,
                          record);

            TestPublishExceptionAspect(something,
                                       record);

            StatusAspect(something,
                         record);
        }
示例#3
0
 public void DoSomethingStatus(Record record)
 {
     Console.WriteLine(record);
 }
示例#4
0
 public void DoSomethingThrows(Record record)
 {
     Console.WriteLine("I'm doing something (record) and throw: " + record);
     throw new ArgumentException("Test");
 }
示例#5
0
        private void TestPublishExceptionAspect(ISomething something,
                                                Record record)
        {
            try
            {
                m_Bus.SubscribeAsync <ExceptionThrownMessage>(GetType().FullName,
                                                              ExceptionThrownHandler);

                something.DoSomethingThrows(record);
            }
            catch ( Exception exception )
            {
                m_Logger.Debug("Try/Catch {0}".Inject(exception.Message));
            }
        }
示例#6
0
 private void StatusAspect(ISomething something,
                           Record record)
 {
     something.DoSomethingStatus("");
     something.DoSomethingStatus(record);
 }