Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Map / Update / Internal / Propagator.JoinPropagator.SubstitutingCloneVisitor.cs / 1305376 / Propagator.JoinPropagator.SubstitutingCloneVisitor.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Data.Common; namespace System.Data.Mapping.Update.Internal { internal partial class Propagator { private partial class JoinPropagator { ////// Describes the mode of behavior for the private enum PopulateMode { ///. /// /// Produce a null extension record (for outer joins) marked as modified /// NullModified, ////// Produce a null extension record (for outer joins) marked as preserve /// NullPreserve, ////// Produce a placeholder for a record that is known to exist but whose specific /// values are unknown. /// Unknown, } ////// Fills in a placeholder with join key data (also performs a clone so that the /// placeholder can be reused). /// ////// Clones of placeholder nodes are created when either the structure of the node /// needs to change or the record markup for the node needs to change. /// private static class PlaceholderPopulator { #region Methods ////// Construct a new placeholder with the shape of the given placeholder. Key values are /// injected into the resulting place holder and default values are substituted with /// either propagator constants or progagator nulls depending on the mode established /// by the ///flag. /// /// The key is essentially an array of values. The key map indicates that for a particular /// placeholder an expression (keyMap.Keys) corresponds to some ordinal in the key array. /// /// Placeholder to clone /// Key to substitute /// Key elements in the placeholder (ordinally aligned with 'key') /// Mode of operation. /// Translator context. ///Cloned placeholder with key values internal static PropagatorResult Populate(PropagatorResult placeholder, CompositeKey key, CompositeKey placeholderKey, PopulateMode mode, UpdateTranslator translator) { EntityUtil.CheckArgumentNull(placeholder, "placeholder"); EntityUtil.CheckArgumentNull(key, "key"); EntityUtil.CheckArgumentNull(placeholderKey, "placeholderKey"); EntityUtil.CheckArgumentNull(translator, "translator"); // Figure out which flags to apply to generated elements. bool isNull = mode == PopulateMode.NullModified || mode == PopulateMode.NullPreserve; bool preserve = mode == PopulateMode.NullPreserve || mode == PopulateMode.Unknown; PropagatorFlags flags = PropagatorFlags.NoFlags; if (!isNull) { flags |= PropagatorFlags.Unknown; } // only null values are known if (preserve) { flags |= PropagatorFlags.Preserve; } PropagatorResult result = placeholder.Replace(node => { // See if this is a key element int keyIndex = -1; for (int i = 0; i < placeholderKey.KeyComponents.Length; i++) { if (placeholderKey.KeyComponents[i] == node) { keyIndex = i; break; } } if (keyIndex != -1) { // Key value. return key.KeyComponents[keyIndex]; } else { // for simple entries, just return using the markup context for this // populator object value = isNull ? null : node.GetSimpleValue(); return PropagatorResult.CreateSimpleValue(flags, value); } }); return result; } #endregion } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System.Collections.Generic; using System.Data.Common; namespace System.Data.Mapping.Update.Internal { internal partial class Propagator { private partial class JoinPropagator { ////// Describes the mode of behavior for the private enum PopulateMode { ///. /// /// Produce a null extension record (for outer joins) marked as modified /// NullModified, ////// Produce a null extension record (for outer joins) marked as preserve /// NullPreserve, ////// Produce a placeholder for a record that is known to exist but whose specific /// values are unknown. /// Unknown, } ////// Fills in a placeholder with join key data (also performs a clone so that the /// placeholder can be reused). /// ////// Clones of placeholder nodes are created when either the structure of the node /// needs to change or the record markup for the node needs to change. /// private static class PlaceholderPopulator { #region Methods ////// Construct a new placeholder with the shape of the given placeholder. Key values are /// injected into the resulting place holder and default values are substituted with /// either propagator constants or progagator nulls depending on the mode established /// by the ///flag. /// /// The key is essentially an array of values. The key map indicates that for a particular /// placeholder an expression (keyMap.Keys) corresponds to some ordinal in the key array. /// /// Placeholder to clone /// Key to substitute /// Key elements in the placeholder (ordinally aligned with 'key') /// Mode of operation. /// Translator context. ///Cloned placeholder with key values internal static PropagatorResult Populate(PropagatorResult placeholder, CompositeKey key, CompositeKey placeholderKey, PopulateMode mode, UpdateTranslator translator) { EntityUtil.CheckArgumentNull(placeholder, "placeholder"); EntityUtil.CheckArgumentNull(key, "key"); EntityUtil.CheckArgumentNull(placeholderKey, "placeholderKey"); EntityUtil.CheckArgumentNull(translator, "translator"); // Figure out which flags to apply to generated elements. bool isNull = mode == PopulateMode.NullModified || mode == PopulateMode.NullPreserve; bool preserve = mode == PopulateMode.NullPreserve || mode == PopulateMode.Unknown; PropagatorFlags flags = PropagatorFlags.NoFlags; if (!isNull) { flags |= PropagatorFlags.Unknown; } // only null values are known if (preserve) { flags |= PropagatorFlags.Preserve; } PropagatorResult result = placeholder.Replace(node => { // See if this is a key element int keyIndex = -1; for (int i = 0; i < placeholderKey.KeyComponents.Length; i++) { if (placeholderKey.KeyComponents[i] == node) { keyIndex = i; break; } } if (keyIndex != -1) { // Key value. return key.KeyComponents[keyIndex]; } else { // for simple entries, just return using the markup context for this // populator object value = isNull ? null : node.GetSimpleValue(); return PropagatorResult.CreateSimpleValue(flags, value); } }); return result; } #endregion } } } } // 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
- WebAdminConfigurationHelper.cs
- ContractNamespaceAttribute.cs
- ItemContainerGenerator.cs
- TransformerTypeCollection.cs
- MetabaseServerConfig.cs
- ItemAutomationPeer.cs
- WebPartConnectionsCloseVerb.cs
- DisplayMemberTemplateSelector.cs
- _UriTypeConverter.cs
- SystemIPAddressInformation.cs
- Int16.cs
- StorageScalarPropertyMapping.cs
- MonikerSyntaxException.cs
- OracleRowUpdatedEventArgs.cs
- ToggleButtonAutomationPeer.cs
- WpfGeneratedKnownProperties.cs
- InputLanguageManager.cs
- AmbiguousMatchException.cs
- SessionEndingEventArgs.cs
- remotingproxy.cs
- SafeFileMapViewHandle.cs
- NativeMethods.cs
- WindowsMenu.cs
- EventHandlersStore.cs
- TextServicesDisplayAttributePropertyRanges.cs
- Privilege.cs
- CreateUserWizardStep.cs
- XmlSignificantWhitespace.cs
- httpapplicationstate.cs
- NetworkInformationPermission.cs
- SqlDataSourceQueryEditorForm.cs
- AssemblyNameProxy.cs
- XmlStringTable.cs
- Deserializer.cs
- Scripts.cs
- BindingFormattingDialog.cs
- XsltInput.cs
- BlurBitmapEffect.cs
- QilPatternVisitor.cs
- LinkButton.cs
- JsonStringDataContract.cs
- DataGridViewBindingCompleteEventArgs.cs
- DataGridViewImageCell.cs
- Matrix3DStack.cs
- PropertyValueChangedEvent.cs
- GlobalProxySelection.cs
- Token.cs
- Conditional.cs
- OptimisticConcurrencyException.cs
- ContainerUtilities.cs
- CodeTypeDeclarationCollection.cs
- ItemsControl.cs
- LinkLabelLinkClickedEvent.cs
- CssStyleCollection.cs
- MulticastOption.cs
- GridViewSortEventArgs.cs
- MessageTransmitTraceRecord.cs
- EntityParameter.cs
- PropertyChangedEventArgs.cs
- UserPreferenceChangedEventArgs.cs
- DataGridViewDataErrorEventArgs.cs
- IssuedTokenServiceElement.cs
- TextBoxAutoCompleteSourceConverter.cs
- SecureEnvironment.cs
- DeploymentSection.cs
- SimpleRecyclingCache.cs
- AdvancedBindingPropertyDescriptor.cs
- TextEncodedRawTextWriter.cs
- PasswordDeriveBytes.cs
- ILGenerator.cs
- SerializationException.cs
- CssClassPropertyAttribute.cs
- DrawingAttributes.cs
- DataGridViewToolTip.cs
- EnterpriseServicesHelper.cs
- TabPage.cs
- PeerCustomResolverElement.cs
- DeviceSpecificChoiceCollection.cs
- URLIdentityPermission.cs
- CreateUserWizardStep.cs
- BooleanAnimationBase.cs
- ScriptControl.cs
- wgx_sdk_version.cs
- DefaultTextStoreTextComposition.cs
- DbMetaDataCollectionNames.cs
- NumberEdit.cs
- PerfCounterSection.cs
- FileNotFoundException.cs
- _DomainName.cs
- RangeExpression.cs
- SystemException.cs
- VideoDrawing.cs
- SelectionPatternIdentifiers.cs
- PageAsyncTask.cs
- Matrix3DValueSerializer.cs
- QilValidationVisitor.cs
- StringComparer.cs
- ConfigurationStrings.cs
- RbTree.cs
- DataColumnMappingCollection.cs