Skip to content

Commit efaee31

Browse files
committed
fix build errors...again
1 parent 52871da commit efaee31

7 files changed

+49
-24
lines changed

examples/dotnet/Examples/BundleARealmExamples.cs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,37 @@ public async Task TestWriteCopySynced()
7373
// Want to know where the copy is?
7474
var locationOfCopy = existingConfig.DatabasePath;
7575
// :snippet-end:
76+
77+
// :snippet-start: get-sync-session
78+
// :replace-start: {
79+
// "terms": {
80+
// "bundledConfig": "config"
81+
// }
82+
// }
83+
// :replace-end:
84+
realm = Realm.GetInstance(bundledConfig);
85+
// :uncomment-start:
86+
// var session = realm.SyncSession;
87+
// :uncomment-end:
88+
// :snippet-end:
89+
// :snippet-start: pause-synced-realm
90+
// :uncomment-start:
91+
// realm = Realm.GetInstance(config);
92+
// :uncomment-end:
93+
session = realm.SyncSession;
94+
session.Stop();
95+
//later...
96+
session.Start();
97+
// :snippet-end:
98+
// :snippet-start: get-session-state
99+
var sessionState = session.State;
100+
if (sessionState == SessionState.Active){
101+
Console.WriteLine("The session is active");
102+
} else {
103+
Console.WriteLine("The session is inactive");
104+
}
105+
// :snippet-end:
106+
76107
}
77108

78109

@@ -84,6 +115,7 @@ public async Task ExtractAndLoadRealmFile()
84115
// "terms": {
85116
// "Config.AppId": "\"myRealmAppId\""}
86117
// }
118+
// :replace-end:
87119
// If you are using a local realm
88120
var config = RealmConfiguration.DefaultConfiguration;
89121

@@ -94,7 +126,6 @@ public async Task ExtractAndLoadRealmFile()
94126
// :remove-start:
95127
config.Schema = new[] { typeof(Examples.Models.User) };
96128
// :remove-end:
97-
// :replace-end:
98129

99130
// Extract and copy the realm
100131
if (!File.Exists(config.DatabasePath))

examples/dotnet/Examples/DataSyncExamples.cs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class DataSyncExamples
1414
Realms.Sync.User user;
1515
FlexibleSyncConfiguration config;
1616

17-
[OneTimeSetUp]
17+
1818
public void Setup()
1919
{
2020
const string myRealmAppId = Config.FSAppId;
@@ -25,27 +25,8 @@ public void Setup()
2525
config = new FlexibleSyncConfiguration(user);
2626
}
2727

28-
[Test]
2928
public void GetSessionAndState(){
30-
// :snippet-start: get-sync-session
31-
realm = Realm.GetInstance(config);
32-
var session = realm.SyncSession;
33-
// :snippet-end:
34-
// :snippet-start: pause-synced-realm
35-
realm = Realm.GetInstance(config);
36-
session = realm.SyncSession;
37-
session.Stop();
38-
//later...
39-
session.Start();
40-
// :snippet-end:
41-
// :snippet-start: get-session-state
42-
var sessionState = session.State;
43-
if (sessionState == SessionState.Active){
44-
Console.WriteLine("The session is active");
45-
} else {
46-
Console.WriteLine("The session is inactive");
47-
}
48-
// :snippet-end:
29+
4930
}
5031
}
5132
}

source/examples/generated/dotnet/BundleARealmExamples.snippet.extract_and_copy_realm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var config = RealmConfiguration.DefaultConfiguration;
33

44
// If the realm file is a synced realm
5-
var app = App.Create("myRealmAppId");
5+
var app = App.Create(Config.AppId);
66
var user = await app.LogInAsync(Credentials.Anonymous());
77
config = new PartitionSyncConfiguration("myPartition", user);
88

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var sessionState = session.State;
2+
if (sessionState == SessionState.Active){
3+
Console.WriteLine("The session is active");
4+
} else {
5+
Console.WriteLine("The session is inactive");
6+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
realm = Realm.GetInstance(bundledConfig);
2+
var session = realm.SyncSession;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
realm = Realm.GetInstance(config);
2+
session = realm.SyncSession;
3+
session.Stop();
4+
//later...
5+
session.Start();

source/sdk/dotnet/sync/sync-session.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ method on the paused session, the Sync session resumes.
3131
The following code block demonstrates calling the ``Stop()`` and ``Start()``
3232
methods:
3333

34-
.. literalinclude:: /examples/generated/dotnet/DataSyncExamples.snippet.pause-synced-realm.cs
34+
.. literalinclude:: /examples/generated/dotnet/BundleARealmExamples.snippet.pause-synced-realm.cs
3535
:language: csharp
3636

3737
When to Pause a Sync Session

0 commit comments

Comments
 (0)