Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Query / InternalTrees / ExplicitDiscriminatorMap.cs / 1305376 / ExplicitDiscriminatorMap.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Data.Metadata.Edm; using System.Collections.Generic; using System.Linq; namespace System.Data.Query.InternalTrees { ////// Describes user-defined discriminator metadata (e.g. for a basic TPH mapping). Encapsulates /// relevant data from System.Data.Mapping.ViewGenerabetion.DiscriminatorMap (that is to say, /// data relevant to the PlanCompiler). This separate class accomplishes two things: /// /// 1. Maintain separation of ViewGen and PlanCompiler /// 2. Avoid holding references to CQT expressions in ITree ops (which the ViewGen.DiscriminatorMap /// holds a few CQT references) /// internal class ExplicitDiscriminatorMap { private readonly System.Collections.ObjectModel.ReadOnlyCollection> m_typeMap; private readonly EdmMember m_discriminatorProperty; private readonly System.Collections.ObjectModel.ReadOnlyCollection m_properties; internal ExplicitDiscriminatorMap(System.Data.Mapping.ViewGeneration.DiscriminatorMap template) { m_typeMap = template.TypeMap; m_discriminatorProperty = template.Discriminator.Property; m_properties = template.PropertyMap.Select(propertyValuePair => propertyValuePair.Key) .ToList().AsReadOnly(); } /// /// Maps from discriminator value to type. /// internal System.Collections.ObjectModel.ReadOnlyCollection> TypeMap { get { return m_typeMap; } } /// /// Gets property containing discriminator value. /// internal EdmMember DiscriminatorProperty { get { return m_discriminatorProperty; } } ////// All properties for the type hierarchy. /// internal System.Collections.ObjectModel.ReadOnlyCollectionProperties { get { return m_properties; } } /// /// Returns the type id for the given entity type, or null if non exists. /// internal object GetTypeId(EntityType entityType) { object result = null; foreach (var discriminatorTypePair in this.TypeMap) { if (discriminatorTypePair.Value.EdmEquals(entityType)) { result = discriminatorTypePair.Key; break; } } return result; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- PresentationAppDomainManager.cs
- XPathArrayIterator.cs
- TransactionScope.cs
- FactoryGenerator.cs
- RoleGroupCollection.cs
- MasterPageParser.cs
- __Filters.cs
- _NegoStream.cs
- CharConverter.cs
- TcpClientSocketManager.cs
- InputLanguage.cs
- ButtonColumn.cs
- BitmapEffectOutputConnector.cs
- XmlSchemaAnyAttribute.cs
- FormatException.cs
- Latin1Encoding.cs
- VirtualizingPanel.cs
- DiscoveryClientReferences.cs
- RegionData.cs
- StateManagedCollection.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- StrokeCollection.cs
- AutomationPattern.cs
- ScrollEvent.cs
- UpdateTracker.cs
- SpecialTypeDataContract.cs
- TiffBitmapDecoder.cs
- OutputWindow.cs
- ValueHandle.cs
- CalendarDateRangeChangingEventArgs.cs
- IOThreadScheduler.cs
- DataGridColumnDropSeparator.cs
- PropertyValueEditor.cs
- XDeferredAxisSource.cs
- ContentType.cs
- Stackframe.cs
- StorageComplexPropertyMapping.cs
- SafeLibraryHandle.cs
- DataFormat.cs
- PasswordPropertyTextAttribute.cs
- BatchWriter.cs
- ObjectSet.cs
- ControlAdapter.cs
- SqlBulkCopyColumnMapping.cs
- DefaultMemberAttribute.cs
- DataPointer.cs
- WebPartConnectionsDisconnectVerb.cs
- ParagraphResult.cs
- TypeToken.cs
- CompileXomlTask.cs
- COM2FontConverter.cs
- XmlComment.cs
- GeneralTransform3D.cs
- StackBuilderSink.cs
- ComNativeDescriptor.cs
- ListCollectionView.cs
- PrintingPermission.cs
- AppDomainProtocolHandler.cs
- SmtpAuthenticationManager.cs
- WindowsProgressbar.cs
- Point3DAnimationUsingKeyFrames.cs
- SparseMemoryStream.cs
- StringFormat.cs
- AsyncCallback.cs
- ArrayTypeMismatchException.cs
- SecureStringHasher.cs
- ExpressionBinding.cs
- RequestCachePolicy.cs
- sitestring.cs
- WeakRefEnumerator.cs
- ServiceOperationParameter.cs
- HierarchicalDataBoundControl.cs
- CodeMemberField.cs
- TextEndOfParagraph.cs
- DesignerInterfaces.cs
- ParserOptions.cs
- NameValueSectionHandler.cs
- MenuItem.cs
- HttpListenerResponse.cs
- DependencyPropertyConverter.cs
- RestHandler.cs
- VisualCollection.cs
- RelationshipConstraintValidator.cs
- TransformerInfo.cs
- DBConnectionString.cs
- WebPartConnection.cs
- DataContractSerializer.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- DateTimeFormatInfoScanner.cs
- DataGridViewAddColumnDialog.cs
- HttpClientCertificate.cs
- DoubleStorage.cs
- ModifierKeysValueSerializer.cs
- SqlDataSourceQueryEditor.cs
- SplitContainer.cs
- CheckBox.cs
- BooleanFacetDescriptionElement.cs
- ContentDesigner.cs
- KeyTime.cs
- RSAPKCS1KeyExchangeFormatter.cs