Tuesday, 15 July 2014

.net - How to choose methods for async calling in C#, how to propagate async -



.net - How to choose methods for async calling in C#, how to propagate async -

i have few async way of writing programme questions. writing wcf service expensive methods, candidates async calling. questions implementations are:

if create async method in model, need mark service method async able await model method, , alter homecoming type task<originaltype>. destroy service api convention consistency. right way go? improve design service interface async task returning methods if methods not expensive , there practically no reason create async? as understood, expensive method should written async, in such case 1 half of programme bee synchronous , sec 1 asynchronous. right?

if create async method in model, need mark service method async able await model method, , alter homecoming type task. destroy service api convention consistency. right way go? improve design service interface async task returning methods if methods not expensive , there practically no reason create asnyc?

in wcf, when alter method homecoming task<t>, you're not changing wcf contract, can identify multiple asynchronous pattern single message, means can have 3 patterns (task, sync , apm) in single contract interface, , relate same message.

from msdn:

clients can offer developer programming model choose, long underlying message exchange pattern observed. so, too, can services implement operations in manner, long specified message pattern observed.

this subject covered extend in different forms of wcf service contract interface , asynchronously consume synchronous wcf service

as understood, expensive method should written async, in such case 1 half of programme bee synchronous , sec 1 asynchronous. right?

as @l3arnon said, exposing async api not how "expensive" method is, work method phone call doing. if true asynchronous work, such accessing file system, sending network request, accessing external info source, such database, fit candidate expose async api.

combining these facts wcf, can expose both sync , async method via single contract.

c# .net wcf asynchronous async-await

No comments:

Post a Comment