Example #1
0
        public T AddObjectToTracking <T>(T item)
            where T : IObjectId
        {
            if (item != null)
            {
                var type = item.GetType();
                if (TrackableTypes.ContainsKey(type))
                {
                    var key = item.GetHashCode();

                    if (Trackers.ContainsKey(item.Id))
                    {
                        return((T)Trackers[item.Id].LiveObj);
                    }
                    else
                    {
                        this.Set(type).AddToLoaded(item);
                        var currentTracker = new Tracker <T>(item);
                        this.Trackers.Add(item.Id, currentTracker);
                        return(item);
                    }
                }
            }
            return(default(T));
        }