/// <summary> /// o GetInstance(): This method creates and returns an object of /// type LifetimeEvents /// </summary> /// <returns></returns> public static LifetimeEvents GetInstance() { LifetimeEvents lte = new LifetimeEvents(); lte.strCorrelationIDForLogging = new Guid(); return(lte); }
/// <summary> /// InitializeRuntime(): This method is called when WCF creates the host process. /// It will be overridden to: /// -- Initialize any internal components (like the Logger - if necessary) /// and log the starting of the hosting of the service. /// -- Add custom behaviors to the ServiceHost by making calls to /// AddCustomAuthorizationBehavior() and AddCustomMessageInspectorBehavior() /// -- Perform standard WCF service-host initialization with a call to base.InitializeRuntime() /// </summary> protected override void InitializeRuntime() { //Starting up service LifetimeEvents.Startup(); //initialize Parameters with ASA settings Parameters.Instance.SectionName = "asa"; //Add custom Behaviors AddCustomMessageInspectorBehavior(); if (Parameters.Instance.EnableASAServiceRequestSchemaValidation == true || Parameters.Instance.EnableASAServiceReplySchemaValidation == true) { AddCustomSchemaValidation(); } //Let base finish base.InitializeRuntime(); //Add custom Error Handler if (Parameters.Instance.EnableASAFaultHandling == true) { AddCustomFaultHandling(); } }
/// <summary> /// This method is called when WCF ends the host process. /// It will be overridden to perform releasing of resources from the host, /// and log the closing of the host. /// </summary> protected override void OnClosed() { //Service is closed LifetimeEvents.Close(); //Base can now close base.OnClosed(); }
/// <summary> /// BeforeSendReply(): This method will be used to audit the TID information /// before sending a request message back to the caller. [This will call the /// associated LifetimeEvents.BeforeSendReply(), which will contain the actual /// logic for handling the TID, and performing the audit.] /// </summary> /// <param name="reply"></param> /// <param name="correlationState"></param> public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply, object correlationState) { LifetimeEvents.GetInstance().BeforeSendReply(ref reply, correlationState, svcDescription); }
/// <summary> /// AfterReceiveRequest(): This method will be used to audit TID information /// upon receiving a message at the service. [This will call the associated /// LifetimeEvents.AfterReceiveRequest(), which will contain the actual logic /// for handling the TID, and performing the audit.] /// </summary> /// <param name="request"></param> /// <param name="channel"></param> /// <param name="instanceContext"></param> /// <returns></returns> public object AfterReceiveRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel, InstanceContext instanceContext) { return(LifetimeEvents.GetInstance().AfterReceiveRequest(ref request, channel, instanceContext, svcDescription)); }
/// <summary> /// AfterReceiveReply(): This method will be used to audit TID information upon /// receiving a reply from the service. [This will call the associated /// LifetimeEvents.AfterReceiveReply(), which will contain the actual logic for /// handling the TID, and performing the audit.] /// </summary> /// <param name="reply"></param> /// <param name="correlationState"></param> void IClientMessageInspector.AfterReceiveReply(ref Message reply, object correlationState) { LifetimeEvents.GetInstance().AfterReceiveReply(ref reply, correlationState); }
/// <summary> /// BeforeSendRequest(): This method will be used to audit the TID information /// before sending a request to the service. [This will call the associated /// LifetimeEvents.BeforeSendRequest(), which will contain the actual logic for /// handling the TID, and performing the audit.] /// </summary> /// <param name="request"></param> /// <param name="channel"></param> /// <returns></returns> object IClientMessageInspector.BeforeSendRequest(ref Message request, IClientChannel channel) { return(LifetimeEvents.GetInstance().BeforeSendRequest(ref request, channel, svcEndpoint)); }