Example #1
0
		private static void FetchSalesOrderHeaderEntitiesIndividually()
		{
			Console.WriteLine("Fetching entities individually, LLBLGen Pro v4.1");
			var headers = FetchSalesOrderHeaderEntities();
			int count = 0;
			var sw = new Stopwatch();
			sw.Start();
			foreach(var fetched in headers)
			{
				var toFetch = new SalesOrderHeaderEntity(fetched.SalesOrderId);
				using(var adapter = new DataAccessAdapter())
				{
					adapter.FetchEntity(toFetch);
					if(toFetch.Fields.State != SD.LLBLGen.Pro.ORMSupportClasses.EntityState.Fetched)
					{
						Console.WriteLine("Not fetched. Aborting");
						return;
					}
					count++;
				}
				if(count > 1000)
				{
					break;
				}
			}
			sw.Stop();
			double average = (double)sw.ElapsedMilliseconds / (double)count;
			Console.WriteLine("Fetching {0} entities individually through CTor/PK fetch took {1}ms, or {2}ms/entity", count, sw.ElapsedMilliseconds, average);
		}
Example #2
0
		private static EntityCollection<SalesOrderHeaderEntity> FetchSalesOrderHeaderEntities()
		{
			var frameworkName = CreateFrameworkName("LLBLGen Pro v{0} (v{1})", typeof(DataAccessAdapterBase));
			var sw = new Stopwatch();
			sw.Start();
			var headers = new EntityCollection<SalesOrderHeaderEntity>();
			using(var adapter = new DataAccessAdapter())
			{
				adapter.FetchEntityCollection(headers, null);
			}
			sw.Stop();
			ReportResult(frameworkName, sw.ElapsedMilliseconds, headers.Count);
			foreach(var e in headers)
			{
				if(e.SalesOrderId <= 0)
				{
					Console.WriteLine("LLBL41: Data is empty");
					break;
				}
			}
			return headers;
		}
Example #3
0
		private static void FetchSalesOrderHeaderEntitiesWithCaching()
		{
			var frameworkName = CreateFrameworkName("LLBLGen Pro v{0} (v{1}), with resultset caching", typeof(DataAccessAdapterBase));
			var sw = new Stopwatch();
			sw.Start();
			var qf = new QueryFactory();
			var q = qf.SalesOrderHeader.CacheResultset(5);
			var headers = new EntityCollection<SalesOrderHeaderEntity>();
			using(var adapter = new DataAccessAdapter())
			{
				adapter.FetchQuery(q, headers);
			}
			sw.Stop();
			ReportResult(frameworkName, sw.ElapsedMilliseconds, headers.Count);
			foreach(var e in headers)
			{
				if(e.SalesOrderId <= 0)
				{
					Console.WriteLine("LLBL41 with cache: Data is empty");
					break;
				}
			}
		}