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
- Region.cs
- PrintDialog.cs
- Viewport3DVisual.cs
- PersistenceContextEnlistment.cs
- DocumentEventArgs.cs
- DefaultPrintController.cs
- Constraint.cs
- GenericFlowSwitchHelper.cs
- ToolStripDropDownClosingEventArgs.cs
- PerformanceCounterTraceRecord.cs
- ControlBuilder.cs
- BuildDependencySet.cs
- DataServiceExpressionVisitor.cs
- ColorConvertedBitmapExtension.cs
- BaseProcessProtocolHandler.cs
- EncodingNLS.cs
- XmlQueryTypeFactory.cs
- QilInvokeEarlyBound.cs
- OleDbMetaDataFactory.cs
- DataRowChangeEvent.cs
- XamlTreeBuilderBamlRecordWriter.cs
- PerformanceCounterLib.cs
- SqlNotificationEventArgs.cs
- KerberosSecurityTokenAuthenticator.cs
- codemethodreferenceexpression.cs
- SmtpSection.cs
- Run.cs
- CharacterString.cs
- NavigatingCancelEventArgs.cs
- DesignerMetadata.cs
- QilDataSource.cs
- TemplateBindingExtension.cs
- CacheAxisQuery.cs
- Quaternion.cs
- RegexEditorDialog.cs
- WizardStepBase.cs
- DefaultAsyncDataDispatcher.cs
- TileModeValidation.cs
- LocalsItemDescription.cs
- BinaryReader.cs
- OrderToken.cs
- MessageSmuggler.cs
- MessageDecoder.cs
- TypeDescriptor.cs
- NavigationEventArgs.cs
- SrgsElement.cs
- messageonlyhwndwrapper.cs
- DataGridAutoGeneratingColumnEventArgs.cs
- CommonObjectSecurity.cs
- BaseResourcesBuildProvider.cs
- ModelService.cs
- ping.cs
- SocketConnection.cs
- CompositeCollection.cs
- AssemblySettingAttributes.cs
- WebPartTransformerAttribute.cs
- WebPartConnectionsDisconnectVerb.cs
- XmlDataImplementation.cs
- CachedPathData.cs
- Message.cs
- HealthMonitoringSectionHelper.cs
- SqlAliasesReferenced.cs
- BitmapPalettes.cs
- CodeCommentStatementCollection.cs
- BaseValidator.cs
- Directory.cs
- EmissiveMaterial.cs
- Timer.cs
- DocumentPropertiesDialog.cs
- FunctionCommandText.cs
- XmlText.cs
- TransformValueSerializer.cs
- OdbcConnectionPoolProviderInfo.cs
- Dictionary.cs
- BindingOperations.cs
- HTTPNotFoundHandler.cs
- TargetConverter.cs
- CallContext.cs
- KeyValuePair.cs
- WebServiceParameterData.cs
- PathNode.cs
- XPathScanner.cs
- BuiltInExpr.cs
- FormatConvertedBitmap.cs
- HtmlTextArea.cs
- XmlSchemaProviderAttribute.cs
- DisplayMemberTemplateSelector.cs
- XmlFormatExtensionPrefixAttribute.cs
- TabControl.cs
- FactoryRecord.cs
- BitVector32.cs
- DbDataSourceEnumerator.cs
- TypeForwardedToAttribute.cs
- RSAOAEPKeyExchangeFormatter.cs
- HMACSHA384.cs
- AutomationElementCollection.cs
- ExtendedPropertyDescriptor.cs
- WmfPlaceableFileHeader.cs
- CheckBoxDesigner.cs
- ScriptingRoleServiceSection.cs