Exemplo n.º 1
0
        public void UpdateMultipleDocumentTypes()
        {
            using (var ds = new DocumentStore(_dataDirectory))
            {
                ds.DestroyAllData();

                var person = new PersonEntity() { Name = "MonoDS", Email = "test" };
                var car = new CarEntity() { Name = "MonoDS", Make = "MonoDS", Model = "MonoDS GTI" };

                ds.Store<PersonEntity>(person);
                ds.Store<CarEntity>(car);

                Assert.AreEqual(1, ds.Count<PersonEntity>());
                Assert.AreEqual(1, ds.Count<CarEntity>());
            }

            // update
            using (var ds = new DocumentStore(_dataDirectory))
            {
                var person = ds.All<PersonEntity>().First();
                var car = ds.All<CarEntity>().First();
                person.Name = "MonoDS2";
                car.Name = "MonoDS2";

                ds.Update<PersonEntity>(person);
                ds.Update<CarEntity>(car);
            }

            // check result
            using (var ds = new DocumentStore(_dataDirectory))
            {
                var person = ds.All<PersonEntity>().First();
                var car = ds.All<CarEntity>().First();
                Assert.AreEqual("MonoDS2", person.Name);
                Assert.AreEqual("MonoDS2", car.Name);
            }
        }
Exemplo n.º 2
0
        public void StoreMultipleDocumentTypes()
        {
            using (var ds = new DocumentStore(_dataDirectory))
            {
                ds.DestroyAllData();

                var person = new PersonEntity() { Name = "MonoDS", Email = "test" };
                var car = new CarEntity() { Name = "MonoDS", Make = "MonoDS", Model = "MonoDS GTI" };

                ds.Store<PersonEntity>(person);
                ds.Store<CarEntity>(car);

                Assert.AreEqual(1, ds.Count<PersonEntity>());
                Assert.AreEqual(1, ds.Count<CarEntity>());
            }
        }