Beispiel #1
0
 public void Detach()
 {
     if (!this.IsTracking)
     {
         throw new InvalidOperationException(Strings.DataServiceCollection_OperationForTrackedOnly);
     }
     if (!this.rootCollection)
     {
         throw new InvalidOperationException(Strings.DataServiceCollection_CannotStopTrackingChildCollection);
     }
     this.observer.StopTracking();
     this.observer       = null;
     this.rootCollection = false;
 }
        private void StartTracking(
            DataServiceContext context,
            IEnumerable <T> items,
            String entitySet,
            Func <EntityChangedParams, bool> entityChanged,
            Func <EntityCollectionChangedParams, bool> collectionChanged)
        {
            Debug.Assert(context != null, "Must have a valid context to initialize.");
            Debug.Assert(this.observer == null, "Must have no observer which implies Initialize should only be called once.");

            if (items != null)
            {
                this.InternalLoadCollection(items);
            }

            this.observer = new BindingObserver(context, entityChanged, collectionChanged);

            this.observer.StartTracking(this, entitySet);

            this.rootCollection = true;
        }
Beispiel #3
0
 private void StartTracking(DataServiceContext context, IEnumerable <T> items, string entitySet, Func <EntityChangedParams, bool> entityChanged, Func <EntityCollectionChangedParams, bool> collectionChanged)
 {
     if (!BindingEntityInfo.IsEntityType(typeof(T), context.MaxProtocolVersion))
     {
         throw new ArgumentException(Strings.DataBinding_DataServiceCollectionArgumentMustHaveEntityType(typeof(T)));
     }
     this.observer = new BindingObserver(context, entityChanged, collectionChanged);
     if (items != null)
     {
         try
         {
             this.InternalLoadCollection(items);
         }
         catch
         {
             this.observer = null;
             throw;
         }
     }
     this.observer.StartTracking <T>((DataServiceCollection <T>) this, entitySet);
     this.rootCollection = true;
 }
Beispiel #4
0
 public BindingGraph(BindingObserver observer)
 {
     this.observer = observer;
     this.graph    = new Graph();
 }