public void AllocateIds() { // Snippet: AllocateIds(string,IEnumerable<Key>,CallSettings) // Create client DatastoreClient datastoreClient = DatastoreClient.Create(); // Initialize request argument(s) string projectId = ""; IEnumerable <Key> keys = new List <Key>(); // Make the request AllocateIdsResponse response = datastoreClient.AllocateIds(projectId, keys); // End snippet }
public void AllocateIds_RequestObject() { // Snippet: AllocateIds(AllocateIdsRequest,CallSettings) // Create client DatastoreClient datastoreClient = DatastoreClient.Create(); // Initialize request argument(s) AllocateIdsRequest request = new AllocateIdsRequest { ProjectId = "", Keys = { }, }; // Make the request AllocateIdsResponse response = datastoreClient.AllocateIds(request); // End snippet }
public void AllocateIds() { string projectId = _fixture.ProjectId; string namespaceId = _fixture.NamespaceId; // Snippet: AllocateIds(*,*,*) DatastoreClient client = DatastoreClient.Create(); KeyFactory keyFactory = new KeyFactory(projectId, namespaceId, "message"); AllocateIdsResponse response = client.AllocateIds(projectId, new[] { keyFactory.CreateIncompleteKey(), keyFactory.CreateIncompleteKey() } ); Entity entity1 = new Entity { Key = response.Keys[0], ["text"] = "Text 1" }; Entity entity2 = new Entity { Key = response.Keys[1], ["text"] = "Text 2" }; // End snippet Assert.NotEqual(entity1, entity2); }