Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / InfoCardListRequest.cs / 1 / InfoCardListRequest.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.Collections.Generic; using System.IO; class InfoCardListRequest : UIAgentRequest { InfoCardPolicy m_policy; IListm_allCards; public InfoCardListRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parent ) : base( rpcHandle, inArgs, outArgs, parent ) { } protected override void OnInitializeAsSystem() { base.OnInitializeAsSystem(); m_policy = GetPolicy(); } protected override void OnMarshalInArgs() { // // Nothing to marshall // } protected override void OnProcess() { // // Get the full list of all infocards. // IList rows = ( IList ) GetAllCards(); if ( null != rows && 0 != rows.Count ) { IList cards = new List ( rows.Count ); for ( int i = 0; i < rows.Count; i++ ) { byte[ ] rawForm = rows[ i ].GetDataField(); try { using ( MemoryStream stream = new MemoryStream( rawForm ) ) { cards.Add( new InfoCard( stream ) ); } } finally { Array.Clear( rawForm, 0, rawForm.Length ); } } m_allCards = cards; } } protected override void OnMarshalOutArgs() { Stream stream = OutArgs; BinaryWriter writer = new BinaryWriter( stream ); if ( null != m_allCards && 0 != m_allCards.Count ) { StoreConnection connection = StoreConnection.GetConnection(); try { // // write thte count of the array. // writer.Write( m_allCards.Count ); for ( int i = 0; i < m_allCards.Count; i++ ) { // // Flush the writer to ensure that all data // is committed to the base stream before // we pass the base stream into the card. // writer.Flush(); m_allCards[ i ].AgentSerialize( stream, ( ParentRequest is GetTokenRequest ), m_policy, connection, new System.Globalization.CultureInfo( ParentRequest.UserLanguage ) ); } writer.Flush(); } finally { if ( null != m_allCards ) { foreach ( InfoCard icard in m_allCards ) { icard.ClearSensitiveData(); } } connection.Close(); } } else { // // write the count of the array as 0. // writer.Write( 0 ); } } IList GetAllCards() { StoreConnection connection = StoreConnection.GetConnection(); try { return ( IList ) connection.Query( QueryDetails.FullRow, connection.LocalDataSource, new QueryParameter( SecondaryIndexDefinition.ObjectTypeIndex, (Int32) StorableObjectType.InfoCard ) ); } finally { connection.Close(); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CollectionMarkupSerializer.cs
- NullNotAllowedCollection.cs
- PerfService.cs
- IsolatedStorageException.cs
- LoginName.cs
- HostedImpersonationContext.cs
- HtmlForm.cs
- ComPlusDiagnosticTraceSchemas.cs
- Site.cs
- RectangleF.cs
- XmlSchemaCollection.cs
- SecurityTokenProvider.cs
- CompositionAdorner.cs
- ExpressionTextBox.xaml.cs
- externdll.cs
- MemoryMappedViewStream.cs
- CompositeActivityValidator.cs
- PropertyDescriptorGridEntry.cs
- SymmetricKey.cs
- SqlTypeSystemProvider.cs
- RequestUriProcessor.cs
- SafeNativeMethods.cs
- SafeReadContext.cs
- KeyedCollection.cs
- ArrayConverter.cs
- ItemsPresenter.cs
- CodeTypeMember.cs
- XmlSchemaChoice.cs
- WindowsTreeView.cs
- EnumConverter.cs
- ValidationPropertyAttribute.cs
- DataGridViewAddColumnDialog.cs
- TabItem.cs
- DetailsViewCommandEventArgs.cs
- BasicHttpMessageCredentialType.cs
- Rect.cs
- EntityContainerAssociationSetEnd.cs
- StatusBarItem.cs
- ISAPIWorkerRequest.cs
- CodeMemberEvent.cs
- SerializableAttribute.cs
- FixedSOMTextRun.cs
- PropertyGridCommands.cs
- EventLogPermissionHolder.cs
- ProcessModule.cs
- ImageMap.cs
- FixedDSBuilder.cs
- MsmqTransportElement.cs
- BitmapSourceSafeMILHandle.cs
- ResourceManager.cs
- SQLDoubleStorage.cs
- MenuCommands.cs
- ImageAttributes.cs
- ClockController.cs
- RSAOAEPKeyExchangeDeformatter.cs
- TreeNodeBindingDepthConverter.cs
- SqlDataAdapter.cs
- BindingMAnagerBase.cs
- _SafeNetHandles.cs
- GroupItemAutomationPeer.cs
- StorageEndPropertyMapping.cs
- WebBrowserPermission.cs
- ParseHttpDate.cs
- SymLanguageVendor.cs
- DataGridColumnCollectionEditor.cs
- BindableTemplateBuilder.cs
- XmlComplianceUtil.cs
- CallbackException.cs
- MsmqIntegrationChannelFactory.cs
- HashHelper.cs
- WebServiceMethodData.cs
- figurelength.cs
- SingleObjectCollection.cs
- CryptoProvider.cs
- SafeFileMapViewHandle.cs
- OnOperation.cs
- InputScopeManager.cs
- ApplicationBuildProvider.cs
- DecoderExceptionFallback.cs
- ProviderSettings.cs
- FileCodeGroup.cs
- WebPartCloseVerb.cs
- SqlCachedBuffer.cs
- GridViewCommandEventArgs.cs
- TextServicesManager.cs
- EntityDataSourceView.cs
- DataContractSerializerMessageContractImporter.cs
- SQLDateTime.cs
- CustomAttributeBuilder.cs
- ApplyHostConfigurationBehavior.cs
- DataPagerFieldCollection.cs
- ArgIterator.cs
- SpoolingTaskBase.cs
- ValidationManager.cs
- DiscoveryDocumentSearchPattern.cs
- ItemDragEvent.cs
- XsltConvert.cs
- XmlAttributeAttribute.cs
- TileBrush.cs
- SchemaImporterExtensionElement.cs