Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- UnionCqlBlock.cs
- ItemAutomationPeer.cs
- LoginViewDesigner.cs
- IdleTimeoutMonitor.cs
- TextTreeInsertElementUndoUnit.cs
- WpfXamlMember.cs
- NoPersistHandle.cs
- BoolExpr.cs
- TextDecoration.cs
- ButtonAutomationPeer.cs
- ActivatableWorkflowsQueryResult.cs
- RecognizerInfo.cs
- TableStyle.cs
- XmlIgnoreAttribute.cs
- PageContentAsyncResult.cs
- CustomCredentialPolicy.cs
- SynchronizationLockException.cs
- ArrayElementGridEntry.cs
- SettingsPropertyWrongTypeException.cs
- DrawListViewItemEventArgs.cs
- ContourSegment.cs
- TextTreeInsertElementUndoUnit.cs
- DynamicMetaObject.cs
- StorageMappingItemCollection.cs
- IntSecurity.cs
- DecoderExceptionFallback.cs
- LinqMaximalSubtreeNominator.cs
- TreeViewEvent.cs
- FileDialog.cs
- RuleSettings.cs
- ExponentialEase.cs
- NumericPagerField.cs
- DesigntimeLicenseContextSerializer.cs
- FileRecordSequenceCompletedAsyncResult.cs
- XmlException.cs
- ImageAttributes.cs
- FileAuthorizationModule.cs
- embossbitmapeffect.cs
- CommandHelpers.cs
- LinqDataSourceEditData.cs
- TextEditorSelection.cs
- RegexCompiler.cs
- EditingCommands.cs
- IncrementalCompileAnalyzer.cs
- URIFormatException.cs
- Span.cs
- CryptoConfig.cs
- VectorCollectionConverter.cs
- PropertySegmentSerializationProvider.cs
- TextShapeableCharacters.cs
- GroupByExpressionRewriter.cs
- BaseValidatorDesigner.cs
- XsltSettings.cs
- InvokeWebServiceDesigner.cs
- FileUtil.cs
- TraceSwitch.cs
- OperationAbortedException.cs
- EdmEntityTypeAttribute.cs
- IsolationInterop.cs
- DeferredSelectedIndexReference.cs
- ArraySegment.cs
- CacheChildrenQuery.cs
- DialogResultConverter.cs
- WeakHashtable.cs
- ReliableSessionBindingElementImporter.cs
- ObjectQuery_EntitySqlExtensions.cs
- QilGeneratorEnv.cs
- HttpCacheParams.cs
- TaskFileService.cs
- XmlUnspecifiedAttribute.cs
- SqlUDTStorage.cs
- SelectionHighlightInfo.cs
- ApplicationActivator.cs
- TaskForm.cs
- Activator.cs
- ColorAnimationBase.cs
- ChangeInterceptorAttribute.cs
- SoapSchemaMember.cs
- _Events.cs
- SqlNotificationRequest.cs
- ImageMap.cs
- EventWaitHandleSecurity.cs
- CalendarSelectionChangedEventArgs.cs
- AddInToken.cs
- XmlCustomFormatter.cs
- ITreeGenerator.cs
- DateTimeHelper.cs
- CellParaClient.cs
- ArrangedElement.cs
- DtrList.cs
- GradientStop.cs
- InputLanguage.cs
- BitmapEffect.cs
- X500Name.cs
- TdsParserHelperClasses.cs
- CodeConditionStatement.cs
- XPathBinder.cs
- IncomingWebRequestContext.cs
- VirtualPathData.cs
- ControlDesignerState.cs