ASP.NET Web Service + Module + Public variable = thread safe? -


in asp.net web service i've included module in public declared variables. thread-safe? mixed upon simultaneous calls?

those variables datsset, datatable , sqldataadapter..

partial code of module:

 imports system.data.oledb imports system.diagnostics  module modcommon      public bdolog boolean     public scurrentodbc string     public cn sqlconnection     public query1ds dataset     public query1 datatable     public query1adapter sqldataadapter 

@scripni

thanks, i'm not familiary suggestions, move locally.

additionally, following variables thread-safe?:

 [toolboxitem(false)]_ public class service1       inherits system.web.services.webservice        dim sname string       dim scurrentpath string        [webmethod()]_      public function capture(byval spath string) string            sname = "joe"      end function  end class  

if you're using web services yes, have concurency problems when multiple services try access same resource, , sqlconnection definetly resource don't want shared.

you should make sure don't have simultaneous calls properties (for ex. wrapping fields getters / setters , implementing locks in methods) or moving code class , instantiating class whenever need it.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -