public async System.Threading.Tasks.Task WithBidiManyToManyAsync()
        {
            using (ISession session = OpenSession())
                using (var trx = session.BeginTransaction())
                {
                    var father   = new PersonM2M();
                    var mother   = new PersonM2M();
                    var son      = new PersonM2M();
                    var daughter = new PersonM2M();

                    var home   = new AddressM2M();
                    var office = new AddressM2M();

                    home.AddPerson(father);
                    home.AddPerson(mother);
                    home.AddPerson(son);
                    home.AddPerson(daughter);

                    office.AddPerson(father);
                    office.AddPerson(mother);

                    await(session.SaveAsync(home));
                    await(session.SaveAsync(office));

                    Assert.DoesNotThrowAsync(() => { return(trx.CommitAsync()); });
                }

            // 4 Person inserts, 2 Address inserts, 6 PersonAddresses inserts
            Assert.AreEqual(3, StatsBatcher.BatchSizes.Count, "Unexpected batches count");
        }
Exemple #2
0
        public void WithBidiManyToMany()
        {
            using (ISession session = OpenSession())
                using (var trx = session.BeginTransaction())
                {
                    var father   = new PersonM2M();
                    var mother   = new PersonM2M();
                    var son      = new PersonM2M();
                    var daughter = new PersonM2M();

                    var home   = new AddressM2M();
                    var office = new AddressM2M();

                    home.AddPerson(father);
                    home.AddPerson(mother);
                    home.AddPerson(son);
                    home.AddPerson(daughter);

                    office.AddPerson(father);
                    office.AddPerson(mother);

                    session.Save(home);
                    session.Save(office);

                    Assert.DoesNotThrow(() => { trx.Commit(); });
                }

            // 4 Person inserts, 2 Address inserts, 6 PersonAddresses inserts
            Assert.AreEqual(3, StatsBatcher.BatchSizes.Count, "Unexpected batches count");
        }