-
-
Save FransBouma/5576427 to your computer and use it in GitHub Desktop.
First LLBLGen Pro v4.0 async api results. :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ConnectionString = @"data source=zeusVM\SQLSERVER2005;initial catalog=AdventureWorks;integrated security=SSPI;persist security info=False;packet size=4096"; | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Starting"); | |
FetchEntityCollectionAsync(); | |
Console.WriteLine("Fetch called. Press enter to quit"); | |
Console.ReadLine(); | |
} | |
private static async Task FetchEntityCollectionAsync() | |
{ | |
int localId = 0; | |
var task1 = FetchSalesOrderHeaderEntitiesAsync(localId++); | |
var task2 = FetchSalesOrderHeaderEntitiesAsync(localId++); | |
var task3 = FetchSalesOrderHeaderEntitiesAsync(localId++); | |
var task4 = FetchSalesOrderHeaderEntitiesAsync(localId++); | |
var task5 = FetchSalesOrderHeaderEntitiesAsync(localId++); | |
var task6 = FetchSalesOrderHeaderEntitiesAsync(localId++); | |
var task7 = FetchSalesOrderHeaderEntitiesAsync(localId++); | |
await Task.WhenAll(task1, task2, task3, task4, task5, task6, task7); | |
} | |
public static async Task FetchSalesOrderHeaderEntitiesAsync(int localId) | |
{ | |
Console.WriteLine("Entering async fetch collection method. LocalID {0}", localId); | |
var qf = new QueryFactory(); | |
var q = qf.SalesOrderHeader; | |
var sw = new Stopwatch(); | |
sw.Start(); | |
var headers = new EntityCollection<SalesOrderHeaderEntity>(); | |
using(var adapter = new DataAccessAdapter()) | |
{ | |
await adapter.FetchQueryAsync(q, headers, CancellationToken.None); | |
} | |
sw.Stop(); | |
Console.WriteLine("Fetched {0} LLBLGen Pro v4 entities from the DB. Took {1}ms. LocalID {2}", headers.Count, sw.ElapsedMilliseconds, localId); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Starting | |
Entering async fetch collection method. LocalID 0 | |
Entering async fetch collection method. LocalID 1 | |
Entering async fetch collection method. LocalID 2 | |
Entering async fetch collection method. LocalID 3 | |
Entering async fetch collection method. LocalID 4 | |
Entering async fetch collection method. LocalID 5 | |
Entering async fetch collection method. LocalID 6 | |
Fetch called. Press enter to quit | |
Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 3314ms. LocalID 3 | |
Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 3395ms. LocalID 1 | |
Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 3527ms. LocalID 5 | |
Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 4123ms. LocalID 0 | |
Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 5008ms. LocalID 2 | |
Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 5973ms. LocalID 4 | |
Fetched 31465 LLBLGen Pro v4 entities from the DB. Took 6037ms. LocalID 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment