1
- // Copyright 2017, Google Inc. All rights reserved.
1
+ // Copyright 2017, Google Inc. All rights reserved.
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -53,8 +53,9 @@ public class City
53
53
public async Task AttributedClassUsage ( )
54
54
{
55
55
string projectId = _fixture . ProjectId ;
56
+ string databaseId = _fixture . DatabaseId ;
56
57
// Sample: AttributedClassUsage
57
- FirestoreDb db = FirestoreDb . Create ( projectId ) ;
58
+ FirestoreDb db = new FirestoreDbBuilder { ProjectId = projectId , DatabaseId = databaseId } . Build ( ) ;
58
59
59
60
// Create a document with a random ID in the "cities" collection.
60
61
CollectionReference collection = db . Collection ( "cities" ) ;
@@ -79,8 +80,9 @@ public async Task AttributedClassUsage()
79
80
public async Task DictionaryUsage ( )
80
81
{
81
82
string projectId = _fixture . ProjectId ;
83
+ string databaseId = _fixture . DatabaseId ;
82
84
// Sample: DictionaryUsage
83
- FirestoreDb db = FirestoreDb . Create ( projectId ) ;
85
+ FirestoreDb db = new FirestoreDbBuilder { ProjectId = projectId , DatabaseId = databaseId } . Build ( ) ;
84
86
85
87
// Create a document with a random ID in the "cities" collection.
86
88
CollectionReference collection = db . Collection ( "cities" ) ;
@@ -105,8 +107,9 @@ public async Task DictionaryUsage()
105
107
public async Task AnonymousTypeUsage ( )
106
108
{
107
109
string projectId = _fixture . ProjectId ;
110
+ string databaseId = _fixture . DatabaseId ;
108
111
// Sample: AnonymousTypeUsage
109
- FirestoreDb db = FirestoreDb . Create ( projectId ) ;
112
+ FirestoreDb db = new FirestoreDbBuilder { ProjectId = projectId , DatabaseId = databaseId } . Build ( ) ;
110
113
111
114
// Create a document with a random ID in the "cities" collection.
112
115
CollectionReference collection = db . Collection ( "cities" ) ;
@@ -148,7 +151,8 @@ public class HighScore
148
151
public async Task AnonymousTypeSentinel ( )
149
152
{
150
153
string projectId = _fixture . ProjectId ;
151
- FirestoreDb db = FirestoreDb . Create ( projectId ) ;
154
+ string databaseId = _fixture . DatabaseId ;
155
+ FirestoreDb db = new FirestoreDbBuilder { ProjectId = projectId , DatabaseId = databaseId } . Build ( ) ;
152
156
153
157
// Create a document with a random ID in the "scores" collection.
154
158
CollectionReference collection = db . Collection ( "scores" ) ;
@@ -300,9 +304,10 @@ public class ChatRoom
300
304
[ Fact ]
301
305
public async Task SnapshotAttributes ( )
302
306
{
303
- // Sample: SnapshotAttributesUsage
304
307
string projectId = _fixture . ProjectId ;
305
- FirestoreDb db = FirestoreDb . Create ( projectId ) ;
308
+ string databaseId = _fixture . DatabaseId ;
309
+ // Sample: SnapshotAttributesUsage
310
+ FirestoreDb db = new FirestoreDbBuilder { ProjectId = projectId , DatabaseId = databaseId } . Build ( ) ;
306
311
307
312
// Create a document with a random ID in the "rooms" collection.
308
313
CollectionReference collection = db . Collection ( "rooms" ) ;
@@ -326,6 +331,8 @@ public async Task SnapshotAttributes()
326
331
public async Task ConverterRegistry ( )
327
332
{
328
333
string projectId = _fixture . ProjectId ;
334
+ string databaseId = _fixture . DatabaseId ;
335
+
329
336
// Sample: ConverterRegistry
330
337
FirestoreDb db = new FirestoreDbBuilder
331
338
{
@@ -351,7 +358,8 @@ public async Task ConverterRegistry()
351
358
public async Task EnumSerializationByName ( )
352
359
{
353
360
string projectId = _fixture . ProjectId ;
354
- FirestoreDb db = FirestoreDb . Create ( projectId ) ;
361
+ string databaseId = _fixture . DatabaseId ;
362
+ FirestoreDb db = new FirestoreDbBuilder { ProjectId = projectId , DatabaseId = databaseId } . Build ( ) ;
355
363
CollectionReference collection = db . Collection ( "enums" ) ;
356
364
DocumentReference document = await collection . AddAsync ( new { Value = SerializedByName . FirstValue } ) ;
357
365
DocumentSnapshot snapshot = await document . GetSnapshotAsync ( ) ;
@@ -374,7 +382,8 @@ public enum SerializedByName
374
382
public async Task ValueTuples ( )
375
383
{
376
384
string projectId = _fixture . ProjectId ;
377
- FirestoreDb db = FirestoreDb . Create ( projectId ) ;
385
+ string databaseId = _fixture . DatabaseId ;
386
+ FirestoreDb db = new FirestoreDbBuilder { ProjectId = projectId , DatabaseId = databaseId } . Build ( ) ;
378
387
CollectionReference collection = db . Collection ( "snippet-users" ) ;
379
388
Company company = new Company
380
389
{
0 commit comments