Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DataEntity / System / Data / Query / InternalTrees / ExplicitDiscriminatorMap.cs / 1 / 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
- XmlSerializerFactory.cs
- StopStoryboard.cs
- PrintControllerWithStatusDialog.cs
- HyperLinkDesigner.cs
- PictureBox.cs
- ListViewGroup.cs
- FloaterBaseParaClient.cs
- AutoGeneratedField.cs
- HttpApplicationFactory.cs
- MTConfigUtil.cs
- Helpers.cs
- ChineseLunisolarCalendar.cs
- ThreadExceptionDialog.cs
- ReadContentAsBinaryHelper.cs
- XmlDocumentFragment.cs
- printdlgexmarshaler.cs
- NumericUpDownAcceleration.cs
- TrackBarRenderer.cs
- URIFormatException.cs
- IntegrationExceptionEventArgs.cs
- MexHttpBindingElement.cs
- EdmPropertyAttribute.cs
- ThreadExceptionEvent.cs
- WebServiceFaultDesigner.cs
- LayoutDump.cs
- RegexCaptureCollection.cs
- SequenceQuery.cs
- dataprotectionpermission.cs
- BooleanAnimationUsingKeyFrames.cs
- QilUnary.cs
- ActivityMarkupSerializer.cs
- SettingsProperty.cs
- ActivationServices.cs
- FixedSOMGroup.cs
- DrawingAttributesDefaultValueFactory.cs
- ByteKeyFrameCollection.cs
- NamedPipeConnectionPool.cs
- AssemblyCache.cs
- xsdvalidator.cs
- EntityDataSourceChangedEventArgs.cs
- DecimalAnimationUsingKeyFrames.cs
- CultureSpecificCharacterBufferRange.cs
- SoapEnumAttribute.cs
- PathGeometry.cs
- ExceptionRoutedEventArgs.cs
- CodeTypeConstructor.cs
- CustomAttributeBuilder.cs
- CfgParser.cs
- HttpRuntimeSection.cs
- ImageIndexConverter.cs
- DataGridCaption.cs
- ServiceBusyException.cs
- Ipv6Element.cs
- WaitHandleCannotBeOpenedException.cs
- FieldBuilder.cs
- ServerIdentity.cs
- HotCommands.cs
- TemplateBuilder.cs
- ComboBoxDesigner.cs
- SafeCryptoKeyHandle.cs
- RawAppCommandInputReport.cs
- _KerberosClient.cs
- CodeIterationStatement.cs
- OneOfScalarConst.cs
- StoreItemCollection.Loader.cs
- ObjectHelper.cs
- ObjectStateManagerMetadata.cs
- FunctionDescription.cs
- ToolStripContainer.cs
- XmlKeywords.cs
- StylusPoint.cs
- StringResourceManager.cs
- ModuleBuilderData.cs
- SpellCheck.cs
- DetailsViewInsertEventArgs.cs
- ContentFilePart.cs
- IFlowDocumentViewer.cs
- CompModHelpers.cs
- ExtendedTransformFactory.cs
- _BaseOverlappedAsyncResult.cs
- WindowsFormsLinkLabel.cs
- NonValidatingSecurityTokenAuthenticator.cs
- ToolStripManager.cs
- HttpConfigurationContext.cs
- ReadOnlyCollectionBuilder.cs
- ObjectReferenceStack.cs
- OletxEnlistment.cs
- SpAudioStreamWrapper.cs
- CustomErrorCollection.cs
- SettingsSection.cs
- VisualState.cs
- SqlDelegatedTransaction.cs
- Operand.cs
- ImageListStreamer.cs
- KeyValuePair.cs
- ContextMarshalException.cs
- PointAnimationClockResource.cs
- FixUp.cs
- QueryTaskGroupState.cs
- PropertyPathConverter.cs