已不再支援此瀏覽器。
請升級至 Microsoft Edge,以利用最新功能、安全性更新和技術支援。
應該使用哪一個程式碼區塊來建立用戶端,以便僅使用連接字串連線到 Azure Cosmos DB 帳戶?
string connectionString = "<cosmos-connection-string>"; using CosmosClient client = new(connectionString);
string connectionString = "<cosmos-connection-string>"; using CosmosClient client = new(connectionString, "");
string connectionString = "<cosmos-connection-string>"; using CosmosClient client = new();
請考慮沒有任何資源的新 Azure Cosmos DB 帳戶。 哪一個程式碼區塊會建立第一個伺服器端資源,該資源需要儲存一組容器?
using CosmosClient client = new( connectionString: cosmosConnectionString );
Container container = await database.CreateContainerIfNotExistsAsync( "products", partitionKeyPath: "/department", throughput: 400 );
Database database = await client.CreateDatabaseIfNotExistsAsync( "adventureworks" );
項目已存在於 Azure Cosmos DB for NoSQL 帳戶中,其唯一識別碼為 04b3038c-b966-4a86-a1f3-5d1fa5c2a47c。 下列哪一個程式碼區塊會將容器中的現有項目取代為新建立的項目,而沒有建立全新項目的風險。
04b3038c-b966-4a86-a1f3-5d1fa5c2a47c
Item item = new("04b3038c-b966-4a86-a1f3-5d1fa5c2a47c", "item-category", "item-name", 0, true); container.UpsertItemAsync(item);
Item item = new("04b3038c-b966-4a86-a1f3-5d1fa5c2a47c", "item-category", "item-name", 0, true); container.ReplaceItemAsync("04b3038c-b966-4a86-a1f3-5d1fa5c2a47c", item);
Item item = new("04b3038c-b966-4a86-a1f3-5d1fa5c2a47c", "item-category", "item-name", 0, true); container.CreateItemAsync(item);
以下是 Azure Cosmos DB for NoSQL 查詢: SELECT * FROM container c WHERE c.partitionKey == 'some-category' ORDER BY c.id。 什麼是與此查詢相等的 Language-integrated Query (LINQ)?
SELECT * FROM container c WHERE c.partitionKey == 'some-category' ORDER BY c.id
using FeedIterator<Product> feed = container.GetItemLinqQueryable<Item>() .OrderBy(i => i.partitionKey) .ToFeedIterator();
using FeedIterator<Product> feed = container.GetItemLinqQueryable<Item>() .Where(i => i.id == "some-category") .ToFeedIterator();
using FeedIterator<Product> feed = container.GetItemLinqQueryable<Item>() .Where(i => i.partitionKey == "some-category") .OrderBy(i => i.id) .ToFeedIterator();
您必須先回答所有問題,才能檢查進度。
繼續
此頁面對您有幫助嗎?