GetRecipientRequest.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / GetRecipientRequest.cs / 1 / GetRecipientRequest.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{ 
    using System;
    using System.IO; 
    using System.Security; 
    using System.Security.Cryptography.X509Certificates;
    using System.Collections; 
    using System.Collections.Generic;
    using Microsoft.InfoCards.Diagnostics;
    using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace;
    // 
    // This class handles a UI request for recipient information
    // 
    class GetRecipientRequest :UIAgentRequest 
    {
        string          m_recipientId; 
        Recipient       m_recipient;


        // 
        // Summary
        //  Create a new request to return recipient related information 
        // 
        public GetRecipientRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parent )
            : base( rpcHandle, inArgs, outArgs, parent ) 
        {
        }

 
        protected override void OnMarshalInArgs()
        { 
            BinaryReader reader = new InfoCardBinaryReader( InArgs, System.Text.Encoding.Unicode ); 

            m_recipientId = Utility.DeserializeString( reader ); 
        }

        //
        // Summary 
        //  Retrive the recipient related data
        // 
        protected override void OnProcess() 
        {
 

            IDT.Assert( null != m_recipientId, "null thumb print" );

            StoreConnection connection = StoreConnection.GetConnection(); 
            try
            { 
 
                //
                // Retrieve the recipient object from the store 
                //
                List paramList = new List();
                QueryParameter query = new QueryParameter(
                                                          SecondaryIndexDefinition.ObjectTypeIndex, 
                                                          (Int32)StorableObjectType.Recipient );
                paramList.Add( query ); 
                query = new QueryParameter( 
                                          SecondaryIndexDefinition.RecipientIdIndex,
                                          m_recipientId ); 
                paramList.Add( query );
                DataRow row = connection.GetSingleRow( paramList.ToArray() );

                if( null != row ) 
                {
                    m_recipient = new Recipient( new MemoryStream( row.GetDataField() ) ); 
                } 
            }
            finally 
            {
                connection.Close();
            }
        } 

        // 
        // Summary 
        //  Serialize the output in the following order
        //    Recipient 
        //
        //
        protected override void OnMarshalOutArgs()
        { 

            BinaryWriter writer = new BinaryWriter( OutArgs, System.Text.Encoding.Unicode ); 
            IDT.Assert( null != m_recipient, "null recipient" ); 

            IDT.TraceDebug( "Serialize the recipient" ); 
            m_recipient.Serialize( writer );

        }
 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK