Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in...
Transcript of Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in...
![Page 1: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/1.jpg)
Fast, Faster... Async ASP.NETTiberiu Covaci
Level: Intermediate
![Page 2: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/2.jpg)
Who am I?
Tiberiu ’Tibi’ Covaci
Software engineer, 25 years experience
CTO for Learning Connexions
MCT since 2004, teaching .NET
Telerik MVP & Insider
MVP in Azure/ASP.NET
Geek
@tibor19
![Page 3: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/3.jpg)
Agenda
ASP.NET Page lifecycle
Load test your application
Asynchronous pages
Asynchronous actions
Async support in C# vNext
![Page 4: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/4.jpg)
ASP.NET Page lifecycle
Init
Load
PreRender
PreRender
Complete
![Page 5: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/5.jpg)
DEMO
Introducing the Application.
![Page 6: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/6.jpg)
Sync vs Ansync
Synchronous
Call method => Wait for result
One method at a time
Easy to program/understand
Asynchronous
Call method => Return right away
Result / method completion provided via callback
Run several methods at the same time
Scalability
Harder to program
![Page 7: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/7.jpg)
EventHandler Delegate
• void Invoke(object sender, EventArgs e)
• IAsyncResult BeginInvoke(
object sender,
EventArgs e,
AsyncCallback cb,
object state)• void EndInvoke(IAsyncResult ar)
![Page 8: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/8.jpg)
ASP.NET Async Page lifecycle
Init
Load
PreRender
PreRender
Complete
Async calls
![Page 9: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/9.jpg)
DEMO
Asynchronizing the
Application.
![Page 10: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/10.jpg)
Async support in C# vNext
• “Looks like” synchronous programming
• Uses Task/Task<T> behind the courtains
• Two new contextual keywords
async marks a method as asynchrnous
await yields control while waiting on a task to complete
![Page 11: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/11.jpg)
APM=>Async
public static Task<SqlDataReader> ExecuteReaderAsync(SqlCommand cmd)
{
var tcs = new TaskCompletionSource<SqlDataReader>();
cmd.BeginExecuteReader(iar =>
{
try
{
tcs.TrySetResult(cmd.EndExecuteReader(iar));
}
catch (Exception exc)
{
tcs.TrySetException(exc);
}
}, null);
return tcs.Task;
}
![Page 12: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/12.jpg)
DEMO
Modernizing the
Application.
![Page 13: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/13.jpg)
Summary
ASP.NET Page lifecycle
Load test your application
Asynchronous pages
Asynchronous actions
Async support in C# vNext
![Page 14: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/14.jpg)
Q & A
![Page 15: Fast, Faster Async ASPsddconf.com/brands/sdd/library/Fast_Faster_Async_ASP.NET.pdfMVP in Azure/ASP.NET Geek @tibor19 Agenda ASP.NET Page lifecycle Load test your application Asynchronous](https://reader034.fdocuments.in/reader034/viewer/2022050521/5fa49468afb0f81134737b5e/html5/thumbnails/15.jpg)
Thank-you!
• Please fill out the evaluation!
• Contact me by
Email [email protected]
Twitter tibor19
And Don’t Forget to Write!