private static void InsertProductWithGuidId(ISessionFactory sessionFactory, System.Diagnostics.Stopwatch stopWatch)
        {
            Console.WriteLine("Start executing insert product with guid id");

            stopWatch.Start();

            using (var session = sessionFactory.OpenSession())
                using (var transaction = session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted))
                {
                    for (var i = 0; i < AmountOfInserts; i++)
                    {
                        var product = new ProductWithGuid()
                        {
                            Id          = Guid.NewGuid(),
                            Name        = "A very long productname",
                            Description = "A very long description of a product with a very long name",
                            Price       = 22,
                            Category    = "Books"
                        };
                        session.Save(product);
                    }

                    transaction.Commit();
                }

            stopWatch.Stop();
            var result = stopWatch.ElapsedMilliseconds;

            Console.WriteLine("Total time (in milliseconds) for executing query: " + result);
        }
		public new void Init()
		{
			ActiveRecordStarter.ResetInitializationFlag();
			ActiveRecordStarter.Initialize(GetConfigSource(), typeof(ProductWithGuid));

			Recreate();

			var product1 = new ProductWithGuid { Key = Key1 };
			product1.Save();

			var product2 = new ProductWithGuid { Key = Key2 };
			product2.Save();
		}
예제 #3
0
        public new void Init()
        {
            ActiveRecordStarter.ResetInitializationFlag();
            ActiveRecordStarter.Initialize(GetConfigSource(), typeof(ProductWithGuid));

            Recreate();

            var product1 = new ProductWithGuid {
                Key = Key1
            };

            product1.Save();

            var product2 = new ProductWithGuid {
                Key = Key2
            };

            product2.Save();
        }
예제 #4
0
 public void TestSetup()
 {
     Assert.That(ProductWithGuid.FindAll().Length, Is.EqualTo(2));
 }