Home
Manage Your Code
Snippet: SPROCTraceListener (C#)
Title: SPROCTraceListener Language: C#
Description: SPROCTraceListener Views: 576
Author: Kris Guy Date Added: 11/27/2011
Copy Code  
1[ConfigurationElementType(typeof(CustomTraceListenerData))]
2public class SPROCTraceListener : CustomTraceListener
3{
4    static SPROCTraceListener()
5    {
6        // get the relevant section from the config file

7        var instrumentation = 
8            ConfigurationManager.GetSection("instrumentation")
9            as InstrumentationConfigSection;
10 
11        // get the  SPROC name and ConnectionString name

12        SPROCName = instrumentation.Database.InsertSprocName;
13        ConnectionString = ConfigurationManager.ConnectionStrings[instrumentation.Database.ConnStringName].ConnectionString;
14    }