DAAB - Profiling, Performance Monitoring

Topics: Data Access Application Block, Exception Handling Application Block, Logging Application Block
Oct 9, 2009 at 5:24 PM

Hi,

we are planning to use DAAB, Exception handling, logging in our application. I am wondering whether a easier way to

  • do profiling and performance monitoring using enterprise application blocks, or should i be using a seperate wrapper for doing these things? 
  • will daab provide a single point of entry to the database? is a wrapper class needed to make a dynamic layer over daab. 

Ours is a data critical accounting project.. Please suggest your opinions.

Oct 12, 2009 at 7:34 AM

Hi,

For performance monitoring, please see the Deployment and Operations section of the Data Access Application Block in the documentation. I'm not sure what do you mean by your 2nd item. Can you explain a bit?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 12, 2009 at 5:15 PM

I want to capture all events between DAAB and DB. Is it possible? if i am calling DAAB, will it be the single point of contact to the database?

Oct 13, 2009 at 8:32 AM

DAAB is already a wrapper class.  What events are specifically talking about, are those the ones which you can capture in the sql server profiler? Is it still for performance monitoring?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Oct 13, 2009 at 5:34 PM

For example, for auditing purpose, I would like to log in all calls made to DAAB (including storedprocedures, insert, update, delete....) and calculate something!!! Is this possible??

Oct 14, 2009 at 6:09 AM

Hi,

The functionality that you are describing are not readily available on the DAAB. My idea of a workaround for this is to create a class that encapsulates a database, then expose methods that will call the methods of the database(internal to the class) then, add a logging handler to eache method. Also, you can implement your own logging facility.

Here is the sample code for my idea, will be create using policy injection:

public class DaabWrapperObject : MarshalByRefObject
    {
        private Database InternalDatabase { get; set; }

        public DaabWrapperObject(string connectionString)
        {
            if (this.InternalDatabase == null)
            {
                this.InternalDatabase = DatabaseFactory.CreateDatabase(connectionString);
            }
        }

        public DaabWrapperObject()
        {
            if (this.InternalDatabase == null)
            {
                this.InternalDatabase = DatabaseFactory.CreateDatabase();
            }
        }

        [LogCallHandler(IncludeParameters=true)]
        public DataSet ExecuteDataSet(string storeProcedureName)
        {
            DbCommand cmd = this.InternalDatabase.GetStoredProcCommand(storeProcedureName);
            return this.InternalDatabase.ExecuteDataSet(cmd);
        }


    }
Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com