예제 #1
0
        /// <summary>
        /// This method is called to finalize changes after all the operations in the current <see cref="ChangeSet"/>
        /// have been invoked. This method commits all the changes made to the <see cref="EntityContext"/>.
        /// </summary>
        /// <exception cref="DataServiceRequestException"> will be thrown in the event of concurrency conflicts.
        /// </exception>
        /// <returns><c>true</c> if the <see cref="ChangeSet"/> was persisted successfully, <c>false</c> otherwise</returns>
        protected override bool PersistChangeSet()
        {
            // Concurrency exceptions here will raise a DataServiceRequestException with the
            // status code of 412 (Precondition Failed). Since we can't identify which entity
            // the precondition failed for or add much other value in this scenario, we'll
            // just let the exception flow through.
            DataServiceResponse response = this.EntityContext.SaveChangesWithRetries();

            return(response.All(r => r.Error == null));
        }
        public static bool IsSuccessStatusCode(this DataServiceResponse response)
        {
            var success = response.All(SuccessStatusCodePredicate);

            return(success);
        }