Code:
/ 4.0 / 4.0 / 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. //---------------------------------------------------------------------- //// 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
- FontSource.cs
- VBCodeProvider.cs
- _OverlappedAsyncResult.cs
- Comparer.cs
- TextBoxBase.cs
- OleDbDataAdapter.cs
- CapiNative.cs
- AccessDataSourceDesigner.cs
- WebConfigurationManager.cs
- JumpPath.cs
- SchemaEntity.cs
- DataGridViewButtonCell.cs
- AssemblyName.cs
- MaskedTextBox.cs
- HwndTarget.cs
- TrustLevel.cs
- MulticastNotSupportedException.cs
- FormParameter.cs
- StreamInfo.cs
- Win32Exception.cs
- DataGridViewLinkCell.cs
- CodeMethodInvokeExpression.cs
- UserControlAutomationPeer.cs
- ClientSession.cs
- ConstrainedDataObject.cs
- FrameworkReadOnlyPropertyMetadata.cs
- AddInSegmentDirectoryNotFoundException.cs
- SQLCharsStorage.cs
- SubpageParagraph.cs
- ProfileBuildProvider.cs
- HtmlInputImage.cs
- PtsHelper.cs
- StrongName.cs
- WorkflowInstance.cs
- Imaging.cs
- MobileUserControl.cs
- HttpRequestWrapper.cs
- Metadata.cs
- InvalidFilterCriteriaException.cs
- TypedReference.cs
- DrawingAttributeSerializer.cs
- TimeSpanSecondsOrInfiniteConverter.cs
- CorePropertiesFilter.cs
- CodeTypeDeclarationCollection.cs
- BufferedStream.cs
- LayoutManager.cs
- ConstructorExpr.cs
- EntityDataSourceView.cs
- DocumentSchemaValidator.cs
- ResourcesChangeInfo.cs
- nulltextcontainer.cs
- AutomationIdentifier.cs
- ErrorHandler.cs
- Table.cs
- StylusLogic.cs
- UInt32Converter.cs
- PrintingPermission.cs
- StaticFileHandler.cs
- ZipIOLocalFileBlock.cs
- InputBinder.cs
- KnownTypeHelper.cs
- Material.cs
- _NativeSSPI.cs
- DbConnectionOptions.cs
- ButtonChrome.cs
- ReceiveDesigner.xaml.cs
- Avt.cs
- InkCanvasInnerCanvas.cs
- StylusSystemGestureEventArgs.cs
- DES.cs
- CalendarDataBindingHandler.cs
- SuppressMessageAttribute.cs
- MouseGesture.cs
- XpsThumbnail.cs
- ToolStripRendererSwitcher.cs
- Tablet.cs
- HttpHostedTransportConfiguration.cs
- _ScatterGatherBuffers.cs
- DBSchemaRow.cs
- IndexedSelectQueryOperator.cs
- DataTableNewRowEvent.cs
- _BasicClient.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- RequestCacheValidator.cs
- TextBoxBase.cs
- TypeUnloadedException.cs
- HtmlElementCollection.cs
- ValidationManager.cs
- FrameworkContentElement.cs
- GotoExpression.cs
- OleDbDataAdapter.cs
- XamlToRtfParser.cs
- VScrollProperties.cs
- StateItem.cs
- JumpPath.cs
- PaginationProgressEventArgs.cs
- TitleStyle.cs
- MailSettingsSection.cs
- AssemblyUtil.cs
- WebPartDescriptionCollection.cs