updating samples to rc version (#505)
This commit is contained in:
Родитель
407d6fde05
Коммит
0e1e2f31d5
|
@ -13,7 +13,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.27" />
|
||||
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="host.json">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
|
|
|
@ -152,9 +152,9 @@
|
|||
//*********************************************************************************************
|
||||
// Get configured performance (reserved throughput) of a CosmosContainer
|
||||
//**********************************************************************************************
|
||||
ThroughputResponse throughputResponse = await simpleContainer.ReadThroughputAsync();
|
||||
int? throughputResponse = await simpleContainer.ReadThroughputAsync();
|
||||
|
||||
Console.WriteLine($"\n2. Found throughput \n{throughputResponse.Resource.Throughput.Value}\nusing container's id \n{simpleContainer.Id}");
|
||||
Console.WriteLine($"\n2. Found throughput \n{throughputResponse}\nusing container's id \n{simpleContainer.Id}");
|
||||
|
||||
//******************************************************************************************************************
|
||||
// Change performance (reserved throughput) of CosmosContainer
|
||||
|
@ -168,7 +168,7 @@
|
|||
// Get the offer again after replace
|
||||
throughputResponse = await simpleContainer.ReadThroughputAsync();
|
||||
|
||||
Console.WriteLine($"3. Found throughput \n{throughputResponse.Resource.Throughput.Value}\n using container's ResourceId {simpleContainer.Id}.\n");
|
||||
Console.WriteLine($"3. Found throughput \n{throughputResponse}\n using container's ResourceId {simpleContainer.Id}.\n");
|
||||
}
|
||||
// </GetAndChangeContainerPerformance>
|
||||
|
||||
|
@ -194,7 +194,7 @@
|
|||
{
|
||||
Console.WriteLine("\n5. Reading all CosmosContainer resources for a database");
|
||||
|
||||
FeedIterator<ContainerProperties> resultSetIterator = database.GetContainerIterator();
|
||||
FeedIterator<ContainerProperties> resultSetIterator = database.GetContainerQueryIterator<ContainerProperties>();
|
||||
while (resultSetIterator.HasMoreResults)
|
||||
{
|
||||
foreach (ContainerProperties container in await resultSetIterator.ReadNextAsync())
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
|
|
|
@ -83,17 +83,17 @@
|
|||
await readResponse.Database.CreateContainerAsync("testContainer", "/pk");
|
||||
|
||||
// Get the current throughput for the database
|
||||
ThroughputResponse throughputResponse = await database.ReadThroughputAsync();
|
||||
if (throughputResponse.Resource.Throughput.HasValue)
|
||||
int? throughputResponse = await database.ReadThroughputAsync();
|
||||
if (throughputResponse.HasValue)
|
||||
{
|
||||
Console.WriteLine($"\n4. Read a database throughput: {throughputResponse.Resource.Throughput.HasValue}");
|
||||
Console.WriteLine($"\n4. Read a database throughput: {throughputResponse}");
|
||||
|
||||
// Update the current throughput for the database
|
||||
await database.ReplaceThroughputAsync(11000);
|
||||
}
|
||||
|
||||
Console.WriteLine("\n5. Reading all databases resources for an account");
|
||||
FeedIterator<DatabaseProperties> iterator = client.GetDatabaseIterator();
|
||||
FeedIterator<DatabaseProperties> iterator = client.GetDatabaseQueryIterator<DatabaseProperties>();
|
||||
do
|
||||
{
|
||||
foreach (DatabaseProperties db in await iterator.ReadNextAsync())
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.8.1" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
|
||||
QueryDefinition query = new QueryDefinition(
|
||||
"select * from sales s where s.AccountNumber = @AccountInput ")
|
||||
.UseParameter("@AccountInput", "Account1");
|
||||
.WithParameter("@AccountInput", "Account1");
|
||||
|
||||
FeedIterator<SalesOrder> resultSet = container.GetItemQueryIterator<SalesOrder>(
|
||||
query,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
|
|
|
@ -148,13 +148,13 @@
|
|||
// Insert a new item with NonePartitionKeyValue
|
||||
ItemResponse<DeviceInformationItem> createResponse = await container.CreateItemAsync<DeviceInformationItem>(
|
||||
item: itemWithoutPK,
|
||||
partitionKey: PartitionKey.NonePartitionKeyValue);
|
||||
partitionKey: PartitionKey.None);
|
||||
Console.WriteLine("Creating Item {0} Status Code {1}", itemid, createResponse.StatusCode);
|
||||
|
||||
// Read an existing item with NonePartitionKeyValue
|
||||
ItemResponse<DeviceInformationItem> readResponse = await container.ReadItemAsync<DeviceInformationItem>(
|
||||
id: itemid,
|
||||
partitionKey: PartitionKey.NonePartitionKeyValue
|
||||
partitionKey: PartitionKey.None
|
||||
);
|
||||
Console.WriteLine("Reading Item {0} Status Code {1}", itemid, readResponse.StatusCode);
|
||||
|
||||
|
@ -163,14 +163,14 @@
|
|||
ItemResponse<DeviceInformationItem> replaceResponse = await container.ReplaceItemAsync<DeviceInformationItem>(
|
||||
item: itemWithoutPK,
|
||||
id: itemWithoutPK.Id,
|
||||
partitionKey: PartitionKey.NonePartitionKeyValue
|
||||
partitionKey: PartitionKey.None
|
||||
);
|
||||
Console.WriteLine("Replacing Item {0} Status Code {1}", itemid, replaceResponse.StatusCode);
|
||||
|
||||
// Delete an item with NonePartitionKeyValue.
|
||||
ItemResponse<DeviceInformationItem> deleteResponse = await container.DeleteItemAsync<DeviceInformationItem>(
|
||||
id: itemid,
|
||||
partitionKey: PartitionKey.NonePartitionKeyValue
|
||||
partitionKey: PartitionKey.None
|
||||
);
|
||||
Console.WriteLine("Deleting Item {0} Status Code {1}", itemid, deleteResponse.StatusCode);
|
||||
}
|
||||
|
@ -229,7 +229,7 @@
|
|||
string itemid = Guid.NewGuid().ToString();
|
||||
DeviceInformationItem itemWithoutPK = GetDeviceWithNoPartitionKey(itemid);
|
||||
ItemResponse<DeviceInformationItem> createResponse = await container.CreateItemAsync<DeviceInformationItem>(
|
||||
partitionKey: PartitionKey.NonePartitionKeyValue,
|
||||
partitionKey: PartitionKey.None,
|
||||
item: itemWithoutPK);
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@
|
|||
// The operation is made in batches to not lose work in case of partial execution
|
||||
int resultsFetched = 0;
|
||||
QueryDefinition sql = new QueryDefinition("select * from r");
|
||||
FeedIterator<DeviceInformationItem> setIterator = container.GetItemQueryIterator<DeviceInformationItem>(sql, requestOptions: new QueryRequestOptions() { PartitionKey = PartitionKey.NonePartitionKeyValue, MaxItemCount = 2 });
|
||||
FeedIterator<DeviceInformationItem> setIterator = container.GetItemQueryIterator<DeviceInformationItem>(sql, requestOptions: new QueryRequestOptions() { PartitionKey = PartitionKey.None, MaxItemCount = 2 });
|
||||
while (setIterator.HasMoreResults)
|
||||
{
|
||||
FeedResponse<DeviceInformationItem> queryResponse = await setIterator.ReadNextAsync();
|
||||
|
@ -262,7 +262,7 @@
|
|||
|
||||
// Deleting item from fixed container with CosmosContainerSettings.NonePartitionKeyValue.
|
||||
ItemResponse<DeviceInformationItem> deleteResponseWithoutPk = await container.DeleteItemAsync<DeviceInformationItem>(
|
||||
partitionKey: PartitionKey.NonePartitionKeyValue,
|
||||
partitionKey: PartitionKey.None,
|
||||
id: item.Id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
List<Family> families = new List<Family>();
|
||||
|
||||
// SQL
|
||||
FeedIterator<Family> setIterator = container.GetItemIterator<Family>(maxItemCount: 1);
|
||||
FeedIterator<Family> setIterator = container.GetItemQueryIterator<Family>(requestOptions: new QueryRequestOptions { MaxItemCount = 1});
|
||||
while (setIterator.HasMoreResults)
|
||||
{
|
||||
int count = 0;
|
||||
|
@ -122,7 +122,7 @@
|
|||
int totalCount = 0;
|
||||
|
||||
// SQL
|
||||
FeedIterator setIterator = container.GetItemStreamIterator();
|
||||
FeedIterator setIterator = container.GetItemQueryStreamIterator();
|
||||
while (setIterator.HasMoreResults)
|
||||
{
|
||||
int count = 0;
|
||||
|
@ -187,8 +187,8 @@
|
|||
// notice here how we are doing an equality comparison on the string value of City
|
||||
|
||||
QueryDefinition query = new QueryDefinition("SELECT * FROM Families f WHERE f.id = @id AND f.Address.City = @city")
|
||||
.UseParameter("@id", "AndersonFamily")
|
||||
.UseParameter("@city", "Seattle");
|
||||
.WithParameter("@id", "AndersonFamily")
|
||||
.WithParameter("@city", "Seattle");
|
||||
|
||||
List<Family> results = new List<Family>();
|
||||
FeedIterator<Family> resultSetIterator = container.GetItemQueryIterator<Family>(query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Anderson")});
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
|
||||
// 3. Run the script. Pass "Hello, " as parameter.
|
||||
// The script will take the 1st document and echo: Hello, <document as json>.
|
||||
StoredProcedureExecuteResponse<string> response = await container.Scripts.ExecuteStoredProcedureAsync<string, string>(new PartitionKey(doc.LastName), scriptId, "Hello");
|
||||
StoredProcedureExecuteResponse<string> response = await container.Scripts.ExecuteStoredProcedureAsync<string, string>(scriptId, "Hello", new PartitionKey(doc.LastName));
|
||||
|
||||
Console.WriteLine("Result from script: {0}\r\n", response.Resource);
|
||||
|
||||
|
@ -181,7 +181,7 @@
|
|||
dynamic[] args = new dynamic[] { JsonConvert.DeserializeObject<dynamic>(argsJson) };
|
||||
|
||||
// 6. execute the batch.
|
||||
StoredProcedureExecuteResponse<int> scriptResult = await cosmosScripts.ExecuteStoredProcedureAsync<dynamic, int>(new PartitionKey("Andersen"), scriptId, args);
|
||||
StoredProcedureExecuteResponse<int> scriptResult = await cosmosScripts.ExecuteStoredProcedureAsync<dynamic, int>(scriptId, args, new PartitionKey("Andersen"));
|
||||
|
||||
// 7. Prepare for next batch.
|
||||
int currentlyInserted = scriptResult.Resource;
|
||||
|
@ -191,7 +191,7 @@
|
|||
// 8. Validate
|
||||
int numDocs = 0;
|
||||
|
||||
FeedIterator<dynamic> setIterator = container.GetItemIterator<dynamic>();
|
||||
FeedIterator<dynamic> setIterator = container.GetItemQueryIterator<dynamic>();
|
||||
while (setIterator.HasMoreResults)
|
||||
{
|
||||
FeedResponse<dynamic> response = await setIterator.ReadNextAsync();
|
||||
|
@ -227,9 +227,9 @@
|
|||
{
|
||||
// 3. Run the stored procedure.
|
||||
StoredProcedureExecuteResponse<OrderByResult> response = await cosmosScripts.ExecuteStoredProcedureAsync<object, OrderByResult>(
|
||||
new PartitionKey("Andersen"),
|
||||
scriptId,
|
||||
new { filterQuery, orderByFieldName, continuationToken });
|
||||
new { filterQuery, orderByFieldName, continuationToken },
|
||||
new PartitionKey("Andersen"));
|
||||
|
||||
// 4. Process stored procedure response.
|
||||
continuationToken = response.Resource.Continuation;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0.18-preview" />
|
||||
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.0.0-rc1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче