Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2004

Tip: Looking for answers? Try searching our database.

Request specific singleton in webservice ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Poul Lund J?rgensen - 28 May 2004 12:58 GMT
Hi,

I would like to use the singleton pattern in a webservice in order to
ensure one and only one instance of certains objects within the
context of the webservice request.

When I try to build the usual singleton pattern with the static
instance variable I notice that the static member is shared between
different webservice call which is NOT what I want.

I am considering using the HttpContext.Current.Items dictonary as a
kind of webservice local singleton storage in order to avoid the
singletons being shared between webservice call, but it would require
a lot refactoring in the current application.

Does anyone know a better way to obtain webservice locale singletons ?

best regards
Poul Lund Jørgensen
Charlie Nilsson [MSFT] - 28 May 2004 16:14 GMT
You'll have to use static variables or maintain an index / collection
that's shared in your web service call.   Start by thinking what objects
are created and then destroyed by the SOAP / web service calls, independent
of other calls.

Maybe you would want to store this variable in the WebService.Context
object (of type System.Web.HttpContext) which is created for the request.  
Check out the "Items" collection member variable.

--
CharlieN
DevDiv

This posting is provided "AS IS" with no warranties, and confers no rights.

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.  

--------------------
> From: poul_lund_joergensen@hotmail.com (Poul Lund J?rgensen)
> Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
[quoted text clipped - 7 lines]
> Content-Transfer-Encoding: 8bit
> X-Trace: posting.google.com 1085745501 1877 127.0.0.1 (28 May 2004
11:58:21 GMT)
> X-Complaints-To: groups-abuse@google.com
> NNTP-Posting-Date: Fri, 28 May 2004 11:58:21 +0000 (UTC)
> Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwi
x.com!newsfeed.cwix.com!prodigy.com!prodigy.com!news.glorb.com!postnews1.goo
gle.com!not-for-mail
> Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:24047
> X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 17 lines]
> best regards
> Poul Lund J?rgensen

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.