0

Because petapoco it's not async, I found another library https://github.com/tmenier/AsyncPoco

But this AsyncPoco it's 100% async.

If one library ( petapoco ) it's 100% sync and another (AsyncPoco) is 100% async, is it possible to use petapoco with sync and async Repository pattern + Unit of Work ?

Example:

public interface IProductRepository 
{
  IEnumerable<ProductEntity> ListAll();
  Task<IList<ProductEntity>> ListAllAsync();
}
Lucas Roselli
  • 2,810
  • 1
  • 15
  • 18
  • The repo says: _"AsyncPoco … does not supercede PetaPoco; the two can peacefully co-exist in the same project. When making the decision to go asynchronous, it's generally best to go "all in", but keeping both around can be helpful while making a gradual transition."_ – stuartd Jan 17 '17 at 10:49
  • @stuartd thank you for answer, this is exactly what I'm asking, how can both coexist using the repository pattern + unit of work, sorry if I wasn't clear – Lucas Roselli Jan 17 '17 at 10:56
  • You use the sync library for the sync methods, and the async one for the async methods..? – stuartd Jan 17 '17 at 10:58
  • So, you are saying that in my unit of work class I should keep both databases object (one from Petapoco and the other from AsyncPoco) ? Than all my repositories class should receive both databases objects ? – Lucas Roselli Jan 17 '17 at 11:04
  • I can't really say, as I don't know the details. How you actually implement sync and async though should be internal to your class, and not leak outside of it. – stuartd Jan 17 '17 at 11:09
  • 1
    Note since early April PetaPoco now supports sync and async. Regards. – TheLegendaryCopyCoder Apr 18 '19 at 16:30

0 Answers0