コード例 #1
0
        public async System.Threading.Tasks.Task Setup()
        {
            app    = App.Create(myRealmAppId);
            user   = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result;
            config = new SyncConfiguration("myPart", user);
            //:hide-start:
            config.ObjectClasses = new[]
            {
                typeof(Task),
                typeof(UserTask),
                typeof(UserProject)
            };
            //:hide-end:
            var realm = await Realm.GetInstanceAsync(config);

            var synchronousRealm = await Realm.GetInstanceAsync(config);

            var testTask = new Task
            {
                Name      = "Do this thing",
                Partition = "myPart",
                Status    = TaskStatus.Open.ToString()
            };

            realm.Write(() =>
            {
                realm.Add(testTask);
            });
            return;
        }
コード例 #2
0
ファイル: Examples.cs プロジェクト: jsflax/docs-realm
        public async System.Threading.Tasks.Task Setup()
        {
            // :code-block-start: initialize-realm
            app = App.Create(myRealmAppId);
            // :code-block-end:
            user = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result;
            // :code-block-start: open-synced-realm
            config = new SyncConfiguration("myPartition", user);
            var realm = await Realm.GetInstanceAsync(config);

            // :code-block-end:
            // :code-block-start: open-synced-realm-sync
            var synchronousRealm = Realm.GetInstance(config);
            // :code-block-end:
            // :code-block-start: create
            var testTask = new Task
            {
                Name   = "Do this thing",
                Status = TaskStatus.Open.ToString()
            };

            realm.Write(() =>
            {
                realm.Add(testTask);
            });
            // :code-block-end:
            testTaskId = testTask._id;
            return;
        }
コード例 #3
0
        public async System.Threading.Tasks.Task Setup()
        {
            app    = App.Create(myRealmAppId);
            user   = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result;
            config = new SyncConfiguration("myPart", user);
            var realm = await Realm.GetInstanceAsync(config);

            var synchronousRealm = Realm.GetInstance(config);
            var testTask         = new Task
            {
                Name   = "Do this thing",
                Status = TaskStatus.Open.ToString()
            };

            realm.Write(() =>
            {
                realm.Add(testTask);
            });
            testTaskId = testTask.Id;

            /* var schemas = config.ObjectClasses;
             * foreach (var schema in schemas)
             * {
             *   Console.WriteLine(schema.FullName);
             * }*/


            return;
        }
コード例 #4
0
        public async System.Threading.Tasks.Task TearDown()
        {
            using (var realm = await Realm.GetInstanceAsync(config))
            {
                var myTask = new Task();
                // :code-block-start: delete
                realm.Write(() =>
                {
                    realm.Remove(myTask);
                });
                // :code-block-end:
                realm.Write(() =>
                {
                    realm.RemoveAll <Task>();
                    realm.RemoveAll <CustomGetterSetter>();
                });
                var user = await app.LogInAsync(Credentials.Anonymous());

                // :code-block-start: logout
                await user.LogOutAsync();

                // :code-block-end:
            }
            return;
        }
コード例 #5
0
        public async System.Threading.Tasks.Task TearDown()
        {
            config = new SyncConfiguration("myPart", user);
            using (var realm = await Realm.GetInstanceAsync(config))
            {
                var myTask = new Task();
                realm.Write(() =>
                {
                    realm.Remove(myTask);
                });
                realm.RemoveAll <Task>();
                var user = await app.LogInAsync(Credentials.Anonymous());

                await user.LogOutAsync();
            }
            return;
        }
コード例 #6
0
        public async System.Threading.Tasks.Task Setup()
        {
            app    = App.Create(myRealmAppId);
            user   = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result;
            config = new SyncConfiguration("myPart", user);
            var realm = await Realm.GetInstanceAsync(config);

            var synchronousRealm = Realm.GetInstance(config);
            var testTask         = new Task
            {
                Name      = "Do this thing",
                Partition = "myPart",
                Status    = TaskStatus.Open.ToString()
            };

            realm.Write(() =>
            {
                realm.Add(testTask);
            });
            testTaskId = testTask.Id;

            return;
        }
コード例 #7
0
        public async System.Threading.Tasks.Task Setup()
        {
            // :code-block-start: initialize-realm
            app = App.Create(myRealmAppId);
            // :code-block-end:
            user = app.LogInAsync(Credentials.EmailPassword("*****@*****.**", "foobar")).Result;
            // :code-block-start: open-synced-realm
            config = new SyncConfiguration("myPart", user);
            //:hide-start:
            config.ObjectClasses = new[]
            {
                typeof(Task),
                typeof(MyClass),
                typeof(dotnet.User),
                typeof(CustomGetterSetter)
            };
            Realm realm;

            //:hide-end:
            try
            {
                realm = await Realm.GetInstanceAsync(config);
            }
            catch (RealmFileAccessErrorException ex)
            {
                Console.WriteLine($@"Error creating or opening the
                    realm file. {ex.Message}");
            }
            //:hide-start:
            realm = await Realm.GetInstanceAsync(config);

            realm.Write(() =>
            {
                realm.RemoveAll <Task>();
            });
            //:hide-end:
            // :code-block-end:
            // :code-block-start: open-synced-realm-sync
            var synchronousRealm = await Realm.GetInstanceAsync(config);

            // :code-block-end:
            // :code-block-start: create
            var testTask = new Task
            {
                Name      = "Do this thing",
                Status    = TaskStatus.Open.ToString(),
                Partition = "myPart"
            };

            realm.Write(() =>
            {
                realm.Add(testTask);
            });
            // :code-block-end:
            testTaskId = testTask.Id;

            /* var schemas = config.ObjectClasses;
             * foreach (var schema in schemas)
             * {
             *   Console.WriteLine(schema.FullName);
             * }*/


            return;
        }