Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / RPIdentityRequirement.cs / 1 / RPIdentityRequirement.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace Microsoft.InfoCards { using System; using System.IO; using System.Xml; using Microsoft.InfoCards.Diagnostics; using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace; // // Summary // This class contains the RP identity requirement of the card // // Remarks // The parentId index is populated with the URI of the InfoCard associated with this set of PII. // internal class RPIdentityRequirement { const Int32 InvalidRow = 0; Uri m_infoCardId; Int32 m_rowId = InvalidRow; bool m_RPIdentityRequirement = false; // // Summary // Creates an uninitialized instance of the RPIdentityRequirement. // // Remarks // This behavior is not supported and is thus declared as private. // private RPIdentityRequirement() { } // // Summary // Creates a new instance of the RPIdentityRequirement associated with the // InfoCard whose Id is specified. // // Parameters // infoCardId - Id of the owning InfoCard // public RPIdentityRequirement( Uri infoCardId, bool RPIdentityRequirement ) : this() { if( null == infoCardId ) { throw IDT.ThrowHelperArgumentNull( "infoCardId" ); } m_infoCardId = infoCardId; m_RPIdentityRequirement = RPIdentityRequirement; } // // Summary // Retrieves the RPIdentityRequirement from the store. // The InfoCard Id specified in the constructor is used as the parent key. // // Parameters // con - Connection to the store to be used to retrieve the object. // public void Get( StoreConnection con ) { if( null == con ) { throw IDT.ThrowHelperArgumentNull( "con" ); } IDT.TraceDebug( "Retrieving the claims for infocard({0})", m_infoCardId ); // // Find the row for the object from the database, returns null if not exists // DataRow row = TryGetRow( con, QueryDetails.FullRow ); // // A RPIdentityRequirement object does not necessarily exist for this infocard // if( null != row ) { // // Populate the claims from the byte array // Deserialize( new MemoryStream( row.GetDataField() ) ); // // Update the row id from the database // m_rowId = row.LocalId; } } // // Summary // Writes all of the RPIdentityRequirement into a binary stream in an unordered sequence. // // Parameters // stream - Stream that will receive the byte stream of each claim. // public void Serialize( Stream stream ) { // // Setup a BinaryWriter to serialize the bytes of each member to the provided stream // BinaryWriter writer = new BinaryWriter( stream, System.Text.Encoding.Unicode ); writer.Write( m_RPIdentityRequirement ); } // // Summary // Reads a RPIdentityRequirement. // // Parameters // stream - Stream that will provide the byte stream of claims. // public void Deserialize( Stream stream ) { BinaryReader reader = new InfoCardBinaryReader( stream, System.Text.Encoding.Unicode ); m_RPIdentityRequirement = reader.ReadBoolean(); } // // Summary // Writes a serialized RPIdentityRequirement object to the store. // // Remarks // The parentId index field is set to the Id of the associated InfoCard. // // Parameters // con - Connection to the store to be used to store the RPIdentityRequirement. // public void Save( StoreConnection con ) { if( null == con ) { throw IDT.ThrowHelperArgumentNull( "con" ); } // // Write the RPIdentityRequirement to the store associated // this collection with the infocard id specified. // IDT.TraceDebug( "Saving the RPIdentityRequirement..." ); // // Try and get the database header information to // see if this is an insert or update. // // Note: The datafield is not part of the projection // in order to avoid unnecessary decryption. // DataRow row = TryGetRow( con, QueryDetails.FullHeader ); if( null == row ) { row = new DataRow(); row.ObjectType = (Int32)StorableObjectType.RPIdentityRequirement; row.GlobalId = Guid.NewGuid(); } // // Populate the parentId index field // row.SetIndexValue( SecondaryIndexDefinition.ParentIdIndex, GlobalId.DeriveFrom( m_infoCardId.ToString() ) ); // // Populate the data object // MemoryStream ms = new MemoryStream(); Serialize( ms ); row.SetDataField( ms.ToArray() ); // // Save the row to the database // con.Save( row ); // // Update the row id in the object in case // this was an insert. // m_rowId = row.LocalId; } public bool StrongIdentityRequired { get { return m_RPIdentityRequirement; } set { m_RPIdentityRequirement = value; } } // // Summary // Queries the store for the RPIdentityRequirement object associated with the InfoCard Id // currently in m_infoCardId. // // Remarks // This function will return null if no object is found in the store. // // Parameters // con - Connection to the store to be used to find the RPIdentityRequirement object. // details - The projection of the store information to be returned. // protected DataRow TryGetRow( StoreConnection con, QueryDetails details ) { IDT.Assert( null != m_infoCardId, "null infocard id" ); // // Retrieve a single object from the database // DataRow row = con.GetSingleRow( details, new QueryParameter( SecondaryIndexDefinition.ObjectTypeIndex, (Int32)StorableObjectType.RPIdentityRequirement ), new QueryParameter( SecondaryIndexDefinition.ParentIdIndex, GlobalId.DeriveFrom( m_infoCardId.ToString() ) ) ); return row; } } } // 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
- SymbolEqualComparer.cs
- CompiledRegexRunnerFactory.cs
- sqlnorm.cs
- StoreContentChangedEventArgs.cs
- ImageConverter.cs
- XPathBinder.cs
- GeneratedView.cs
- PriorityQueue.cs
- ApplicationSecurityInfo.cs
- WorkflowLayouts.cs
- BulletedListEventArgs.cs
- Internal.cs
- LineMetrics.cs
- ResumeStoryboard.cs
- ParallelTimeline.cs
- SqlClientFactory.cs
- WebPartConnectionsCancelEventArgs.cs
- AssociationTypeEmitter.cs
- DesignerActionUIStateChangeEventArgs.cs
- DBSchemaTable.cs
- ExpressionWriter.cs
- EastAsianLunisolarCalendar.cs
- XmlObjectSerializerWriteContext.cs
- DataPointer.cs
- GridEntry.cs
- WebPartCollection.cs
- MessagingDescriptionAttribute.cs
- IssuanceLicense.cs
- JapaneseLunisolarCalendar.cs
- SharedMemory.cs
- SqlBinder.cs
- sqlstateclientmanager.cs
- QilGeneratorEnv.cs
- CanonicalFontFamilyReference.cs
- PersonalizationProviderCollection.cs
- RadioButtonBaseAdapter.cs
- PeerApplication.cs
- GeometryDrawing.cs
- ImageMapEventArgs.cs
- MenuAutomationPeer.cs
- CodeObjectCreateExpression.cs
- TableSectionStyle.cs
- CodeValidator.cs
- EntityParameterCollection.cs
- BuildProvider.cs
- CannotUnloadAppDomainException.cs
- _HeaderInfo.cs
- TimeSpanFormat.cs
- SqlDataAdapter.cs
- Certificate.cs
- ActivityExecutorOperation.cs
- X509Chain.cs
- CompilerTypeWithParams.cs
- SafeSecurityHandles.cs
- XPathSelectionIterator.cs
- SchemaImporterExtension.cs
- TrustSection.cs
- GeneralTransform3DGroup.cs
- WhitespaceRuleLookup.cs
- PriorityBindingExpression.cs
- Permission.cs
- SecurityHelper.cs
- EntityModelSchemaGenerator.cs
- TreeWalker.cs
- SqlUserDefinedTypeAttribute.cs
- HtmlControlAdapter.cs
- SchemaCollectionPreprocessor.cs
- SynchronousReceiveElement.cs
- HttpDebugHandler.cs
- CodeSubDirectoriesCollection.cs
- ImageUrlEditor.cs
- Wizard.cs
- DrawingContextWalker.cs
- WorkflowRuntime.cs
- ItemCheckEvent.cs
- Parallel.cs
- ControlParameter.cs
- HandleCollector.cs
- MenuItem.cs
- TextElementAutomationPeer.cs
- IISMapPath.cs
- DispatchChannelSink.cs
- XmlElement.cs
- ConsoleEntryPoint.cs
- MailBnfHelper.cs
- TargetException.cs
- InvalidCardException.cs
- Inline.cs
- HashHelper.cs
- GACMembershipCondition.cs
- Random.cs
- COM2IDispatchConverter.cs
- EditingContext.cs
- ProviderException.cs
- WorkflowInstanceProvider.cs
- WindowsListBox.cs
- TextModifierScope.cs
- _UncName.cs
- AssemblyCacheEntry.cs
- InstanceKeyCollisionException.cs