Esempio n. 1
0
        public async Task <IActionResult> PutBatchContainer(int id, BatchContainer batchContainer)
        {
            if (id != batchContainer.BatchId)
            {
                return(BadRequest());
            }

            _context.Entry(batchContainer).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BatchContainerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Esempio n. 2
0
 public void CopyClearCache(out BatchContainer mappingBatches)
 {
     CurrentBatches.LockAll(OperationType.Write);
     CurrentBatches.Copy(_previousBatches);
     CurrentBatches.Clear();
     mappingBatches = _previousBatches;
     CurrentBatches.UnlockAll(OperationType.Write);
 }
        public Batch AdoptVertexBuffer(VertexBuffer <TVertexData> buffer, bool draw = true)
        {
            var batch = BatchContainer.Make(buffer);

            this.addBatch(batch, draw);

            return(batch.Batch);
        }
        private void addBatch(BatchContainer batch, bool draw)
        {
            if (this.program != null)
            {
                batch.VertexArray.SetShaderProgram(this.program);
            }

            (draw ? this.activeBatches : this.inactiveBatches).Add(batch);
        }
        public Batch GetEmptyVertexBuffer(bool draw = true)
        {
            var batch = this.unusedBatches.Count > 0
                ? this.unusedBatches.Pop()
                : BatchContainer.Make(null);

            this.addBatch(batch, draw);

            return(batch.Batch);
        }
Esempio n. 6
0
        public async Task <ActionResult <BatchContainer> > PostBatchContainer(BatchContainer batchContainer)
        {
            _context.BatchContainer.Add(batchContainer);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (BatchContainerExists(batchContainer.BatchId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetBatchContainer", new { id = batchContainer.BatchId }, batchContainer));
        }
Esempio n. 7
0
        public async System.Threading.Tasks.Task TestBatch()
        {
            IUserRequest meRequest = graphClient.Me.Request();
            IGraphServiceUsersCollectionRequest newUserRequest = graphClient.Users.Request();                               // We have the ./users URL, query parameters, and request headers.

            User newUser = new User();

            newUser.DisplayName       = "New User";
            newUser.UserPrincipalName = "*****@*****.**";

            IDirectoryObjectWithReferenceRequest managerRequest = graphClient.Me.Manager.Request();                         // We have the /me/manager URL, query parameters, and request headers.
            IDriveItemChildrenCollectionRequest  driveRequest   = graphClient.Me.Drive.Root.Children.Request();             // We have the /me/drive/root/children URL, query parameters, and request headers.

            IEducationRootRequest eduRequest = graphClient.Education.Request();                                             // We have the /education URL, query parameters, and request headers.

            BatchContainer batchContainer = new BatchContainer();
            BatchPart      part1          = batchContainer.AddToBatch(meRequest, Method.GET);                               // I don't think we need a copy of the BatchPart.

            batchContainer.AddToBatch(driveRequest, Method.GET);
            batchContainer.AddToBatch(eduRequest, Method.GET);
            batchContainer.AddToBatch(newUserRequest, Method.POST, 4, newUser, new BatchPart[] { part1 });                  // We have to use reflection to determine which HttpVerb method we are using, and then, what
                                                                                                                            // the return type will be. This might be costly batch scenario can contain a large number
            BatchResponse response = await graphClient.Batch.PostAsync(batchContainer);                                     // of requests across many batches. I think we want to avoid reflection.

            User me = (User)response.batchResponses.Where(i => i.id == 1).First().body;                                     // No auto-deserialization.

            User me2 = (User)response.batchResponses.Where(i => i.body.GetType() == typeof(User)).FirstOrDefault().body;

            foreach (BatchResponsePart part in response.batchResponses)
            {
                var responseItem = part.body; // If we deserialize into a dynamic object, the customer would have
                int statusCode   = part.status;
            }

            Assert.IsNotNull(me.UserPrincipalName);
        }