Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Objects / Internal / EntityWithChangeTrackerStrategy.cs / 1305376 / EntityWithChangeTrackerStrategy.cs
using System; using System.Collections.Generic; using System.Text; using System.Data.Objects.DataClasses; using System.Diagnostics; namespace System.Data.Objects.Internal { ////// Implementation of the change tracking strategy for entities that support change trackers. /// These are typically entities that implement IEntityWithChangeTracker. /// internal sealed class EntityWithChangeTrackerStrategy : IChangeTrackingStrategy { private IEntityWithChangeTracker _entity; ////// Constructs a strategy object that will cause the change tracker to be set onto the /// given object. /// /// The object onto which a change tracker will be set public EntityWithChangeTrackerStrategy(IEntityWithChangeTracker entity) { _entity = entity; } // See IChangeTrackingStrategy documentation public void SetChangeTracker(IEntityChangeTracker changeTracker) { _entity.SetChangeTracker(changeTracker); } // See IChangeTrackingStrategy documentation public void TakeSnapshot(EntityEntry entry) { if (entry != null && entry.WrappedEntity.RequiresComplexChangeTracking) { entry.TakeSnapshot(true); } } // See IChangeTrackingStrategy documentation public void SetCurrentValue(EntityEntry entry, StateManagerMemberMetadata member, int ordinal, object target, object value) { member.SetValue(target, value); } // See IChangeTrackingStrategy documentation public void UpdateCurrentValueRecord(object value, EntityEntry entry) { // Has change tracker, but may or may not be a proxy bool isProxy = entry.WrappedEntity.IdentityType != _entity.GetType(); entry.UpdateRecordWithoutSetModified(value, entry.CurrentValues); if (isProxy) { entry.DetectChangesInProperties(true); // detect only complex property changes } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FixedPageStructure.cs
- TaiwanLunisolarCalendar.cs
- ApplicationTrust.cs
- InvalidCastException.cs
- TypePresenter.xaml.cs
- FlowDocumentFormatter.cs
- SqlCachedBuffer.cs
- MemberPathMap.cs
- ReadWriteObjectLock.cs
- TranslateTransform.cs
- OdbcConnectionPoolProviderInfo.cs
- SamlConditions.cs
- DrawingContext.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- SafeNativeMethods.cs
- ResourceKey.cs
- EventEntry.cs
- XmlLanguage.cs
- Imaging.cs
- backend.cs
- Substitution.cs
- DiscardableAttribute.cs
- ComponentEditorForm.cs
- SignedXml.cs
- KnownAssemblyEntry.cs
- DbQueryCommandTree.cs
- Button.cs
- LayoutTableCell.cs
- ProfileEventArgs.cs
- SecurityResources.cs
- Point3D.cs
- XmlSchemaSubstitutionGroup.cs
- SingleConverter.cs
- SqlBuffer.cs
- QueryReaderSettings.cs
- ResolvedKeyFrameEntry.cs
- WebGetAttribute.cs
- ValueSerializer.cs
- _NegoState.cs
- ColorBlend.cs
- XmlDigitalSignatureProcessor.cs
- GenericWebPart.cs
- UnmanagedMemoryStream.cs
- ClientRoleProvider.cs
- BitmapEffectInput.cs
- TypeCollectionPropertyEditor.cs
- NativeMethods.cs
- X509CertificateCollection.cs
- EventProviderWriter.cs
- TextDataBindingHandler.cs
- DataGridViewHitTestInfo.cs
- ResourceReferenceExpression.cs
- DropShadowBitmapEffect.cs
- InternalDispatchObject.cs
- KnownBoxes.cs
- fixedPageContentExtractor.cs
- TransactionScope.cs
- CriticalFinalizerObject.cs
- SqlDataSourceView.cs
- LinkedResource.cs
- SynchronizationLockException.cs
- DataObject.cs
- ReliableOutputSessionChannel.cs
- CurrencyWrapper.cs
- ValidatorCompatibilityHelper.cs
- ToolStripPanelCell.cs
- HtmlInputReset.cs
- TaskExtensions.cs
- SourceElementsCollection.cs
- XmlKeywords.cs
- BamlRecordWriter.cs
- ComboBox.cs
- BackgroundFormatInfo.cs
- TraceSection.cs
- WebColorConverter.cs
- InputLangChangeEvent.cs
- RowCache.cs
- ExpressionNode.cs
- KeyEventArgs.cs
- EntityContainer.cs
- StackBuilderSink.cs
- SHA512Managed.cs
- CustomLineCap.cs
- NullableDoubleAverageAggregationOperator.cs
- ConstNode.cs
- FaultHandlingFilter.cs
- AudioDeviceOut.cs
- ReadOnlyDictionary.cs
- TextRangeSerialization.cs
- EventWaitHandleSecurity.cs
- ViewRendering.cs
- CopyCodeAction.cs
- BufferBuilder.cs
- Type.cs
- SafeEventLogWriteHandle.cs
- TextAnchor.cs
- Compiler.cs
- DataTableClearEvent.cs
- MetadataFile.cs
- ErrorStyle.cs