Exemplo n.º 1
0
        public void EdmDeltaEntityObject_IsDeltaObject_ReturnsTrueForDeltaObject()
        {
            IEdmEntityType       _type      = new EdmEntityType("NS", "Entity");
            EdmDeltaEntityObject _edmObject = new EdmDeltaEntityObject(_type);

            Assert.True(_edmObject.IsDeltaResource());
        }
        public IHttpActionResult Get()
        {
            EdmChangedObjectCollection changedCollection = new EdmChangedObjectCollection(DeltaCustomerType);
            //Changed or Modified objects are represented as EdmDeltaEntityObjects
            for (int i = 0; i < 10; i++)
            {
                dynamic untypedCustomer = new EdmDeltaEntityObject(DeltaCustomerType);
                untypedCustomer.Id = i;
                untypedCustomer.Name = string.Format("Name {0}", i);
                untypedCustomer.FavoriteNumbers = Enumerable.Range(0, i).ToArray();
                changedCollection.Add(untypedCustomer);
            }

            //Deleted objects are represented as EdmDeltaDeletedObjects
            for (int i = 10; i < 15; i++)
            {
                dynamic untypedCustomer = new EdmDeltaDeletedEntityObject(DeltaCustomerType);
                untypedCustomer.Id = i.ToString();
                untypedCustomer.Reason = DeltaDeletedEntryReason.Deleted;
                changedCollection.Add(untypedCustomer);
            }

            return Ok(changedCollection);
        }