Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proper CloudTableClient instance lifecycle?

I'm using the new WindowsAzure.Storage 2.0 (might not be a revelant information), and I'm implementing data access using CloudTableClient. Most samples I've seen are instanciating a CloudTableClient in the ctor of an ASP MVC Controller (instanciated per web request). Is there any performance penalty doing so? Would it be wise to keep a long running instance in a singleton style?

like image 744
uzul Avatar asked Jan 05 '13 07:01

uzul


1 Answers

You need to create a new instance of CloudTableClient with each request. Instance members are not thread-safe, so you can't share a singleton.

like image 119
mfanto Avatar answered Sep 26 '22 05:09

mfanto