i was following this tutorial here youtubetutorial github
my code below(took out the key for obvious reasons)
using Microsoft.Azure.Cosmos;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace azurebasics {
public partial class App: Application {
public App() {
InitializeComponent();
MainPage = new MainPage();
CreateItem().Wait();
}
private static async Task CreateItem() {
var cosmosUrl = "";
var cosmoskey = "";
var databaseName = "DemoDB";
CosmosClient client = new CosmosClient(cosmosUrl, cosmoskey);
Database database = await client.CreateDatabaseIfNotExistsAsync(databaseName);
Container container = await database.CreateContainerIfNotExistsAsync(
"MyContainerName", "/partitionKeyPath", 400);
dynamic testItem = new {
id = Guid.NewGuid().ToString(), partitionKeyPath = "MyTestPkValue", details = "it's working"
};
var response = await container.CreateItemAsync(testItem);
}
protected override void OnStart() {}
protected override void OnSleep() {}
protected override void OnResume() {}
}
}
so I would run this code and it would create the database with no container as shown here
I'm confused because the connection works if it makes the database. and the only weird thing I found between the github and his tutorial is in the video he has
var response = await container.CreateItemAsync(testItem);
and the github has
ItemResponse<dynamic> response = await container.CreateItemAsync(testItem);
question from:
https://stackoverflow.com/questions/65661746/azure-cosmos-db-is-not-creating-container-under-database-with-no-errors-in-xamar 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…