Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / DeleteCardRequest.cs / 1 / DeleteCardRequest.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // Summary // Processes a delete card request. // // // Specify valid parent requests. // class DeleteCardRequest : UIAgentRequest { Uri m_cardId; // Specifies the card identifier. public DeleteCardRequest( IntPtr rpcHandle, Stream inArgs, Stream outArgs, ClientUIRequest parent ) : base( rpcHandle, inArgs, outArgs, parent ) { } protected override void OnInitializeAsSystem() { base.OnInitializeAsSystem(); } // // Summary // Marshals input arguments for the request. The arguments are read from a stream in binary. // protected override void OnMarshalInArgs() { BinaryReader reader = new InfoCardBinaryReader( InArgs, Encoding.Unicode ); m_cardId = Utility.DeserializeUri( reader ); } // // Summary // Processes the request. // // The InfoCard, the claim collection associated with the card and the ledger entries // associated with the card are deleted from the store. // protected override void OnProcess() { StoreConnection connection = StoreConnection.GetConnection(); try { connection.BeginTransaction(); try { string name = null; // // Delete the infocard - we need the full row to get the name. // DataRow row = connection.GetSingleRow( QueryDetails.FullRow, new QueryParameter( SecondaryIndexDefinition.GlobalIdIndex, GlobalId.DeriveFrom( m_cardId.ToString() ) ) ); if( null != row ) { byte[ ] rawForm = row.GetDataField(); try { using ( MemoryStream stream = new MemoryStream( rawForm ) ) { InfoCard ic = new InfoCard( stream ); name = ic.Name; } } finally { connection.Delete( row ); Array.Clear( rawForm, 0, rawForm.Length ); } } IDT.TraceDebug( "Deleted infocard with id: #{0}", m_cardId ); // // Delete any other rows whose parent id is m_cardId // ListparamList = new List (); QueryParameter query = new QueryParameter( SecondaryIndexDefinition.ParentIdIndex, GlobalId.DeriveFrom( m_cardId.ToString() ) ); paramList.Add( query ); ICollection list = ( ICollection )connection.Query( QueryDetails.Identifiers, paramList.ToArray() ); if( null != list && list.Count > 0 ) { foreach( DataRow rowWithParentIdMatch in list ) { connection.Delete( rowWithParentIdMatch ); } } connection.CommitTransaction(); AuditLog.AuditCardDeletion(); } catch { connection.RollbackTransaction(); throw; } } finally { connection.Close(); } IDT.TraceDebug( "Deleted ledger entries with parent id: #{0}", m_cardId ); } // // Summary // Marshals output arguments for the request. The arguments are written to a stream in binary. // protected override void OnMarshalOutArgs() { // // This request has no output arguments. // } } } // 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
- XmlEventCache.cs
- EdgeProfileValidation.cs
- QueryContinueDragEvent.cs
- DrawToolTipEventArgs.cs
- DoubleAnimationUsingPath.cs
- Lasso.cs
- SQLGuid.cs
- DataGridAutomationPeer.cs
- AddInBase.cs
- SmtpTransport.cs
- TiffBitmapDecoder.cs
- DbBuffer.cs
- PackageDigitalSignature.cs
- ExtractorMetadata.cs
- TerminateDesigner.cs
- ManagedIStream.cs
- RawStylusInputReport.cs
- FragmentQueryKB.cs
- TextReader.cs
- SymmetricAlgorithm.cs
- ArrayTypeMismatchException.cs
- SafeEventLogWriteHandle.cs
- GridSplitter.cs
- WebConfigurationHostFileChange.cs
- mediaclock.cs
- BuildProvider.cs
- EntityObject.cs
- WebExceptionStatus.cs
- ConditionCollection.cs
- UidPropertyAttribute.cs
- RemoteWebConfigurationHostServer.cs
- precedingquery.cs
- DataGridViewSortCompareEventArgs.cs
- PointCollectionConverter.cs
- WebPartAuthorizationEventArgs.cs
- LocatorManager.cs
- FormatterConverter.cs
- TemplateManager.cs
- HostedBindingBehavior.cs
- QilBinary.cs
- TemplateParser.cs
- HostProtectionPermission.cs
- PersonalizableAttribute.cs
- UrlPropertyAttribute.cs
- InputLanguageSource.cs
- StreamGeometry.cs
- ConfigViewGenerator.cs
- HtmlImageAdapter.cs
- SessionPageStatePersister.cs
- QuotedPrintableStream.cs
- SqlReferenceCollection.cs
- DrawingCollection.cs
- CodeArgumentReferenceExpression.cs
- FontDialog.cs
- CodeMemberField.cs
- GeometryValueSerializer.cs
- ProfileGroupSettings.cs
- DataGridRelationshipRow.cs
- AdjustableArrowCap.cs
- AnnouncementClient.cs
- ErrorTableItemStyle.cs
- ChtmlSelectionListAdapter.cs
- EntityDataSourceWrapperCollection.cs
- ObjectAnimationBase.cs
- Validator.cs
- VersionUtil.cs
- MobileDeviceCapabilitiesSectionHandler.cs
- _TransmitFileOverlappedAsyncResult.cs
- DefaultMemberAttribute.cs
- MappingModelBuildProvider.cs
- Utils.cs
- RowUpdatedEventArgs.cs
- TriggerAction.cs
- OleDbConnection.cs
- _DisconnectOverlappedAsyncResult.cs
- FixedTextBuilder.cs
- ReadOnlyTernaryTree.cs
- VectorKeyFrameCollection.cs
- ReadWriteSpinLock.cs
- SBCSCodePageEncoding.cs
- RawMouseInputReport.cs
- CharAnimationBase.cs
- ToolStripDropDownClosedEventArgs.cs
- SrgsElement.cs
- ExpanderAutomationPeer.cs
- StylusOverProperty.cs
- DatePickerDateValidationErrorEventArgs.cs
- BamlWriter.cs
- Emitter.cs
- AmbientProperties.cs
- InputLanguage.cs
- ParallelActivityDesigner.cs
- SkipStoryboardToFill.cs
- ContextMenu.cs
- Transform3DCollection.cs
- Expression.cs
- DataGridViewAutoSizeModeEventArgs.cs
- CustomValidator.cs
- TargetParameterCountException.cs
- DeclaredTypeElement.cs