protected override void OnFixtureSetup()
 {
     var session = SessionFactory.OpenStatelessSession();
     for (int i = 0; i < NumberOfEntities; i++)
     {
         var product = new Product
         {
             Description = "Beskrivning " + i,
             Name = "Namn " + i,
         };
         session.Insert(product);
     }
 }
        public void CanSaveEntity()
        {
            var product = new Product()
            {
                Name = "Strumpa",
                Description = "Strumpa i hög kvalité."
            };

            Save(product);
            FlushAndClear();
            var dbProduct = Session.Get<Product>(product.Id);
            Assert.That(dbProduct, Is.Not.Null);
            Assert.That(dbProduct.Name, Is.EqualTo("Strumpa"));
            Assert.That(dbProduct.Description, Is.EqualTo("Strumpa i hög kvalité."));
        }
 public void InsertWithStatelessSession()
 {
     Time(() =>
     {
         var session = SessionFactory.OpenStatelessSession();
         for (int i = 0; i < NumberOfEntities; i++)
         {
             var product = new Product
                             {
                                 Description = "Beskrivning " + i,
                                 Name = "Namn " + i,
                             };
             session.Insert(product);
         }
     });
 }
 public void InsertWithOrdinarySession()
 {
     Time(() =>
     {
         for (int i = 0; i < NumberOfEntities; i++)
         {
             var product = new Product
                             {
                                 Description = "Beskrivning " + i,
                                 Name = "Namn " + i,
                             };
             Session.Save(product);
         }
         FlushAndClear();
     });
 }
        protected override void OnFixtureSetup()
        {
            var session = SessionFactory.OpenStatelessSession();
            for (int i = 0; i < 2; i++)
            {
                var product = new Product
                {
                    Description = "Beskrivning " + i,
                    Name = "Namn " + i,
                };

                var variant1 = new ProductVariant
                    {
                        Name = i + " Variant 1",
                        Product = product
                    };
                var value = new VariantValue
                    {
                        Name = i + " Val",
                        Variant = variant1
                    };
                variant1.Values.Add(value);

                var variant2 = new ProductVariant
                    {
                        Name = i + " Variant 2",
                        Product = product
                    };

                product.Variants.Add(variant1);
                product.Variants.Add(variant2);

                session.Insert(product);
                session.Insert(variant1);
                session.Insert(variant2);
                session.Insert(value);
            }
            FlushAndClear();
            UseNHibernateProfiler();
        }
 private void InitDb()
 {
     var session = SessionFactory.OpenStatelessSession();
     for (int i = 0; i < NumberOfEntities; i++)
     {
         var product = new Product
                           {
                               Description = "Beskrivning " + i,
                               Name = "Namn " + i,
                           };
         session.Insert(product);
     }
     FlushAndClear();
 }