0
我有以下查詢來檢查Azure DocumentDb數據庫是否存在。此代碼目前與SDK的功能一起使用nuget包版本1.62,但在1.63和1.7中引發運行時空對象異常。當檢查數據庫是否存在Microsoft.Azure.DocumentDb時,Object Null異常nuget包> 1.62
這是錯誤的方式來查詢數據庫是否存在或在以後的SDK版本中是否存在問題?
感謝
using (IReliableReadWriteDocumentClient dbClient = GetDocumentClient())
{
// Check to verify a database with the id does not exist
Database database = dbClient.CreateDatabaseQuery().Where(db => db.Id == databaseId).AsEnumerable().FirstOrDefault();
// If the database does not exist, create a new database
if (database == null)
{
...
}
}