Esempio n. 1
0
        public void ActivityThenLogical()
        {
            var source = new ExtendedTraceSource();

            using (var scope = new ActivityScope(source, "MultipleTracedClassTestScope"))
            {
                var sample1 = new SampleClass();

                sample1 = Extensions.Wrap<SampleClass>(sample1);

                var sample2 = new SampleClass();

                var oppId = "MyLogicalOpp";

                using (var lScope = new LogicalOperationScope(source, "MyLogicalScope"))
                {
                    sample1.Method1();

                    using (var scope2 = new ActivityScope(source, "Sub Activity"))
                    {
                        using (var lScope1 = new LogicalOperationScope(source, "Scope 2"))
                            sample1.TraceInformation("test1");
                        sample2.TraceInformation("test2");
                    }
                }

                var listeners = sample2.Trace.Listeners;
                var listener = listeners.OfType<TransactionTraceListener>().First();

                var log = listener.GetTransaction();
            }
        }
Esempio n. 2
0
        public void DoWork()
        {
            var source = new ExtendedTraceSource("ServerComponent");
            try
            {

                using (var lScope = new LogicalOperationScope(source, "Process C"))
                {

                    var sample2 = new MyServerComponent(source);

                    sample2.TraceEvent(TraceEventType.Information, 10, "Server Message for the Process");

                }

                Trace.WriteLine("Hi");
                Console.WriteLine("HIII");
            }
            catch (Exception ex)
            {
                source.TraceEvent(TraceEventType.Error, 11, ex.ToString());
                Trace.WriteLine(ex.ToString());
                Console.WriteLine(ex.ToString());
            }
            finally {
                source.Close();
            }
        }
Esempio n. 3
0
        public void LogicalThenActivity()
        {
            var source = new ExtendedTraceSource();

            using (var lScope = new LogicalOperationScope(source, "Process C"))
            {

                var sample2 = new SampleClass(source);

                using (var scope = new ActivityScope(source, "Login"))
                {

                    sample2.TraceEvent(TraceEventType.Verbose, 1, "Logged in!");
                }

                using (var scope = new ActivityScope(source, "Validate"))
                {

                    //var service = new TracingTests.ServiceReference1.Service1Client("BasicHttpBinding_IService1");

                    //service.DoWork();

                    sample2.TraceEvent(TraceEventType.Verbose, 2, "Request is Valid");
                }

                using (var scope = new ActivityScope(source, "Update"))
                {
                    sample2.TraceEvent(TraceEventType.Verbose, 3, "Record updating");

                    using (var scope1 = new ActivityScope(source, "COmmit"))
                    {

                        sample2.TraceEvent(TraceEventType.Verbose, 4, "Commit worked");
                    }

                }

            }
        }
Esempio n. 4
0
        void ServerCall()
        {
            var source = new ExtendedTraceSource("ServerComponent");

            using (var lScope = new LogicalOperationScope(source, "Process B"))
            {

                var sample2 = new SampleClass(source);

                sample2.TraceEvent(TraceEventType.Information, 10, "Server Message for the Process");

            }
        }
Esempio n. 5
0
 public SampleClass(ExtendedTraceSource source)
     : base(source)
 {
 }
Esempio n. 6
0
 public MyServerComponent(ExtendedTraceSource source)
     : base(source)
 {
 }
Esempio n. 7
0
 public TracedClass(string sourceName)
 {
     Trace = new ExtendedTraceSource(sourceName);
 }
Esempio n. 8
0
 public TracedClass()
 {
     Trace = new ExtendedTraceSource();
 }
Esempio n. 9
0
 public TracedClass(ExtendedTraceSource source)
 {
     Trace = source;
 }