BLToolkit - is it able to make async database operation? -


i want avoid blocking executing thread slow database read , , bltoolkit dataaccessor much

public abstract class personaccessor : dataaccessor {     [sqltext(@"select * person firstname = @firstname")]     public abstract list<person> getpersonlistbyfirstname(string @firstname);      [sprocname("sp_getpersonlistbylastname")]     public abstract list<person> getpersonlistbylastname(string @lastname); } 

is possible use async operation bltoolkit dataaccessor?

hope able return task<t> , can use await c# 5.0

br.

you may combine async attribute provides begin end pattern , turn task (not tested) :

public abstract class personaccessor : dataaccessor {     [sqltext(@"select * person firstname = @firstname")]     public abstract list<person> getpersonlistbyfirstname(string @firstname);      [async]     public abstract iasyncresult begingetpersonlistbyfirstname(string @firstname, asynccallback callback, object state);      [async]     public abstract list<person> endgetpersonlistbyfirstname(iasyncresult asyncresult);      public task<list<person>> getpersonlistbyfirstnameasync(string @firstname)     {         return task.factory.fromasync(             begingetpersonlistbyfirstname,             endgetpersonlistbyfirstname,             @firstname,              null);     } }  public class testclass  {     public list<person> awaittest(personaccessor personaccessor, string @firstname)     {         return await personaccessor.getpersonlistbyfirstnameasync(@firstname);     } } 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -