Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Data / Microsoft / SqlServer / Server / SmiEventSink_DeferedProcessing.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="SmiEventSink_DeferedProcessing.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">Microsoft</owner>
6 // <owner current="true" primary="false">Microsoft</owner>
7 //------------------------------------------------------------------------------
8
9 namespace Microsoft.SqlServer.Server {
10
11     using System.Data.Sql;
12     using System.Data.SqlClient;
13     using System.Diagnostics;
14
15     // This class exists purely to defer processing of messages until a later time.
16     //  It is designed to allow calling common code that interacts with the SMI layers
17     //  without throwing or otherwise processing messages in the sink until later on.
18     //
19     //  Main example:
20     //      SqlCommand.ExecuteNonQuerySmi calls EventStream.ProcessEvent with it's command event sink (CES)
21     //          ProcessEvent calls OnParametersAvailable on the CES
22     //              OnParametersAvailable sets up a deferedprocessing event sink (DPES) with the CES as its parent
23     //              OnParametersAvailable calls ValueUtils to extract param values passing the DPES
24     //                  ValueUtils calls Smi passing DPES
25     //                      Smi may call MessagePosted, which will send a message up the sink parent chain and save it.
26     //                  ValueUtils calls ProcessMessagesAndThrow on DPES, which skips handling
27     //      ... return up the stack ...
28     //      SqlCommand.ExecuteNonQuerySmi calls CES.ProcessMessagesAndThrow, which handles the messages
29     //              sent from the Smi value extraction code.
30     //
31     //  IMPORTANT: Code that uses the DeferedProccess event sink is responsible for ensuring that
32     //  these messages ARE processed at some point.
33     internal class SmiEventSink_DeferedProcessing : SmiEventSink_Default {
34         internal SmiEventSink_DeferedProcessing ( SmiEventSink parent ) : base(parent) {
35         }
36
37         protected override void DispatchMessages(bool ignoreNonFatalMessages) {
38             // Skip processing messages.  Since messages are sent to parent and calling code will call 
39             //  ProcessMessages against parent, messages ARE NOT LOST!
40         }
41     }
42 }
43