1 //------------------------------------------------------------------------------
2 // <copyright file="IChangeTrackingStrategy.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //------------------------------------------------------------------------------
6 
7 using System;
8 using System.Collections.Generic;
9 using System.Text;
10 using System.Data.Objects.DataClasses;
11 
12 namespace System.Data.Objects.Internal
13 {
14     /// <summary>
15     /// A strategy interface that defines methods used for different types of change tracking.
16     /// Implementors of this interface are used by the EntityWrapper class.
17     /// </summary>
18     internal interface IChangeTrackingStrategy
19     {
20         /// <summary>
21         /// Sets a change tracker onto an entity, or does nothing if the entity does not support change trackers.
22         /// </summary>
23         /// <param name="changeTracker">The change tracker to set</param>
SetChangeTracker(IEntityChangeTracker changeTracker)24         void SetChangeTracker(IEntityChangeTracker changeTracker);
25 
26         /// <summary>
27         /// Takes a snapshot of the entity contained in the given state entry, or does nothing if
28         /// snapshots are not required for the entity.
29         /// </summary>
30         /// <param name="entry">The state entry representing the entity to snapshot</param>
TakeSnapshot(EntityEntry entry)31         void TakeSnapshot(EntityEntry entry);
32 
33         /// <summary>
34         /// Sets the given value onto the entity with the registered change either handled by the
35         /// entity itself or by using the given EntityEntry as the change tracker.
36         /// </summary>
37         /// <param name="entry">The state entry of the entity to for which a value should be set</param>
38         /// <param name="member">State member information indicating the member to set</param>
39         /// <param name="ordinal">The ordinal of the member to set</param>
40         /// <param name="target">The object onto which the value should be set; may be the entity, or a contained complex value</param>
41         /// <param name="value">The value to set</param>
SetCurrentValue(EntityEntry entry, StateManagerMemberMetadata member, int ordinal, object target, object value)42         void SetCurrentValue(EntityEntry entry, StateManagerMemberMetadata member, int ordinal, object target, object value);
43 
44         /// <summary>
45         /// Updates the current value records using Shaper.UpdateRecord but with additional change tracking logic
46         /// added as required by POCO and proxy entities.
47         /// </summary>
48         /// <param name="value">The value</param>
49         /// <param name="entry">The existing ObjectStateEntry</param>
UpdateCurrentValueRecord(object value, EntityEntry entry)50         void UpdateCurrentValueRecord(object value, EntityEntry entry);
51     }
52 }
53