Critical section in singleton


hello,

i have simple singleton class contains function in an asp.net web site

public membershipuser getmovieowner(guid movieid)

    {

         using (moviesdatacontext mdb = new moviesdatacontext())

        {    

                    guid userid = mdb.moviedatas.where(movie=>movie.movieid == movieid)

                                  .select(movie=>movie.userid)

                                  .single();           

                     return membership.getuser(userid);

        }

    }

my question :

is code should in critical section ?

if user1 call function , , user2 call function ,

 isn't possible user2 change movie id parameter of first user ?
or 2 instances of function create in heap ?

two threads can call method without problem. each thread have own movieid parameter in own stack. don't need lock anything.


Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

BizTalk Server 2013 Azure VM Log Shipping and HA for hosts

How to Share webservice object to all user