Example #1
0
        internal static bool TryCreate(object x, object y, MemberSettings settings, out IRefCounted <DiffBuilder> subDiffBuilder)
        {
            bool created;

            subDiffBuilder = TrackerCache.GetOrAdd(x, y, settings, pair => new DiffBuilder(pair, settings), out created);
            return(created);
        }
Example #2
0
 /// <summary>
 /// Synchronizes property values from source to target.
 /// </summary>
 /// <typeparam name="T">The type os <paramref name="source"/> and <paramref name="target"/></typeparam>
 /// <param name="source">The instance to copy property values from</param>
 /// <param name="target">The instance to copy property values to</param>
 /// <param name="settings">Contains configuration for how synchronization will be performed</param>
 /// <returns>A disposable that when disposed stops synchronizing</returns>
 public static IDisposable PropertyValues <T>(T source, T target, PropertiesSettings settings)
     where T : class, INotifyPropertyChanged
 {
     Ensure.NotNull(source, nameof(source));
     Ensure.NotNull(target, nameof(target));
     Ensure.NotSame(source, target, nameof(source), nameof(target));
     Ensure.SameType(source, target);
     VerifyCanSynchronize(source.GetType(), settings, typeof(Synchronize).Name, nameof(PropertyValues));
     return(TrackerCache.GetOrAdd(source, target, settings, pair => new Synchronizer(source, target, settings)));
 }
 internal static IRefCounted <DirtyTrackerNode> GetOrCreate(object x, object y, PropertiesSettings settings, bool isRoot)
 {
     Debug.Assert(x != null, "Cannot track null");
     Debug.Assert(x is INotifyPropertyChanged || x is INotifyCollectionChanged, "Must notify");
     Debug.Assert(y != null, "Cannot track null");
     Debug.Assert(y is INotifyPropertyChanged || y is INotifyCollectionChanged, "Must notify");
     return(TrackerCache.GetOrAdd(
                x,
                y,
                settings,
                pair => new DirtyTrackerNode(pair, settings, isRoot)));
 }
Example #4
0
        internal static IRefCounted <RootChanges> GetOrCreate(object source, PropertiesSettings settings, bool isRoot)
        {
            Debug.Assert(source != null, "Cannot track null");
            if (isRoot)
            {
                Track.Verify.CanTrackType(source.GetType(), settings);
            }
            else
            {
                Track.Verify.CanTrackValue(source, settings);
            }

            return(TrackerCache.GetOrAdd(source, settings, s => new RootChanges(s, settings)));
        }
Example #5
0
 internal static IRefCounted <ChangeTrackerNode> GetOrCreate(INotifyCollectionChanged source, PropertiesSettings settings, bool isRoot)
 {
     Debug.Assert(source != null, "Cannot track null");
     return(TrackerCache.GetOrAdd((object)source, settings, s => new ChangeTrackerNode(s, settings, isRoot)));
 }
Example #6
0
 internal static IRefCounted <DiffBuilder> GetOrCreate(object x, object y, MemberSettings settings)
 {
     return(TrackerCache.GetOrAdd(x, y, settings, pair => new DiffBuilder(pair, settings)));
 }