This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int throughputCurrent = (int)offer.GetPropertyValue<JObject>("content").GetValue("offerThroughput"); | |
log.LogInformation(string.Format("Current provisioned throughput is: {0} RU", throughputCurrent.ToString())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Offer offer = client.CreateOfferQuery().Where(r => r.ResourceLink == selfLink).AsEnumerable().SingleOrDefault(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string selfLink = client.CreateDocumentCollectionQuery(UriFactory.CreateDatabaseUri(config["CosmosDB_DatabaseId"])) | |
.Where(c => c.Id == config["CosmosDB_ContainerId"]) | |
.AsEnumerable() | |
.FirstOrDefault() | |
.SelfLink; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = new ConfigurationBuilder().SetBasePath(context.FunctionAppDirectory) | |
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true) | |
.AddEnvironmentVariables() | |
.Build(); | |
//1) initialize the cosmosdb client | |
using (DocumentClient client = new DocumentClient(new Uri(config["CosmosDB_Uri"]), config["CosmosDB_appKey"])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient, HttpHeaders } from "@angular/common/http"; | |
import * as Cosmos from "@azure/cosmos"; | |
import * as Model from "../models/todoItem"; | |
export class CosmosService { | |
private static instance: CosmosService; | |
private readonly cosmosHost = "<your_db>.documents.azure.com:443/"; | |
private readonly primaryKey = "<primary_key>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import * as CS from '../cosmos-service'; | |
import * as Model from '../../models/todoItem'; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: 'home.page.html', | |
styleUrls: ['home.page.scss'], | |
}) | |
export class HomePage { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Todo { | |
id?: string; | |
description: string; | |
userId: string; | |
completed?: boolean; | |
type : string; | |
} | |
export interface TodoCollection { | |
Documents: Todo[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Threading.Tasks; | |
using JourneyEntities; | |
using Microsoft.Azure.Documents.Client; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Host; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.WindowsAzure.Storage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AccountEndpoint=https://asrdemo-Cosmosdb.documents.azure.com:443/;AccountKey=fU5dxjtsdasthasaawr4NsrwMiDPTR06ybrhn5Hffs23452diV77zd1RjI75nMNLX5QQ==;database=migrationDemo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
CAST(BusinessEntityID AS varchar) AS [id], | |
Name AS [name], | |
AddressType AS [address.addressType], | |
AddressLine1 AS [address.addressLine1], | |
City AS [address.location.city], | |
StateProvinceName AS [address.location.stateProvinceName], | |
PostalCode AS [address.postalCode], | |
CountryRegionName AS [address.countryRegionName] | |
FROM |