<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: HttpContext idiom for Windows Communication Foundation.</title>
	<atom:link href="http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/</link>
	<description>Keep it simple. It will work...</description>
	<lastBuildDate>Fri, 10 Feb 2012 04:38:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Valeriu Caraulean</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-132</link>
		<dc:creator><![CDATA[Valeriu Caraulean]]></dc:creator>
		<pubDate>Fri, 29 Oct 2010 16:35:26 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-132</guid>
		<description><![CDATA[Hmm, since you pointed me, reviewed the code and you&#039;re probably right. 
I think it will be safer to add a lock around creation of the context. 
For the time we had this code in production we haven&#039;t felt any suspicious behavior, probably because it was in a not too active endpoint.]]></description>
		<content:encoded><![CDATA[<p>Hmm, since you pointed me, reviewed the code and you&#8217;re probably right.<br />
I think it will be safer to add a lock around creation of the context.<br />
For the time we had this code in production we haven&#8217;t felt any suspicious behavior, probably because it was in a not too active endpoint.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Job Vermeulen</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-130</link>
		<dc:creator><![CDATA[Job Vermeulen]]></dc:creator>
		<pubDate>Fri, 29 Oct 2010 11:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-130</guid>
		<description><![CDATA[Are you sure this is thread-safe?]]></description>
		<content:encoded><![CDATA[<p>Are you sure this is thread-safe?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Job Vermeulen</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-129</link>
		<dc:creator><![CDATA[Job Vermeulen]]></dc:creator>
		<pubDate>Fri, 29 Oct 2010 11:13:08 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-129</guid>
		<description><![CDATA[Thanks for this very clean solution, I&#039;ve found some other ideas to create this but this one rocks :)]]></description>
		<content:encoded><![CDATA[<p>Thanks for this very clean solution, I&#8217;ve found some other ideas to create this but this one rocks <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valeriu Caraulean</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-32</link>
		<dc:creator><![CDATA[Valeriu Caraulean]]></dc:creator>
		<pubDate>Sat, 18 Apr 2009 21:00:52 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-32</guid>
		<description><![CDATA[@vince
For us, the anwer was &quot;you don&#039;t&quot;.
We don&#039;t keep the state between calls. Our services are steless. And, so far, we&#039;re happy with it...

Back to keeping the state, if your serivice is instantiated &quot;Per Call&quot; you will not have any context between calls. But you can use &quot;Per Session&quot; mode on your services. This way, between calls you&#039;ll have same InstanceContext (and/or the OperationContext, I don&#039;t remember now, sorry).

But if your question was really about &quot;persisting&quot; data to some durable storage, the database does it well.]]></description>
		<content:encoded><![CDATA[<p>@vince<br />
For us, the anwer was &#8220;you don&#8217;t&#8221;.<br />
We don&#8217;t keep the state between calls. Our services are steless. And, so far, we&#8217;re happy with it&#8230;</p>
<p>Back to keeping the state, if your serivice is instantiated &#8220;Per Call&#8221; you will not have any context between calls. But you can use &#8220;Per Session&#8221; mode on your services. This way, between calls you&#8217;ll have same InstanceContext (and/or the OperationContext, I don&#8217;t remember now, sorry).</p>
<p>But if your question was really about &#8220;persisting&#8221; data to some durable storage, the database does it well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vince</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-31</link>
		<dc:creator><![CDATA[vince]]></dc:creator>
		<pubDate>Sat, 18 Apr 2009 17:35:12 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-31</guid>
		<description><![CDATA[Ok, the context works. But how do you persist the data between calls to the service. Items are cleared on each call. I have no idea how this session works on WCF.]]></description>
		<content:encoded><![CDATA[<p>Ok, the context works. But how do you persist the data between calls to the service. Items are cleared on each call. I have no idea how this session works on WCF.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Valeriu Caraulean</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-30</link>
		<dc:creator><![CDATA[Valeriu Caraulean]]></dc:creator>
		<pubDate>Thu, 19 Mar 2009 13:42:33 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-30</guid>
		<description><![CDATA[I haven&#039;t working with WCF for a while and I don&#039;t remember details, but probably you&#039;re right...]]></description>
		<content:encoded><![CDATA[<p>I haven&#8217;t working with WCF for a while and I don&#8217;t remember details, but probably you&#8217;re right&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-29</link>
		<dc:creator><![CDATA[shlomi]]></dc:creator>
		<pubDate>Thu, 19 Mar 2009 13:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-29</guid>
		<description><![CDATA[Found the solution - instead of using InstanceContext extension - use OperationContext extension. I think this is also more appropriate to what you meant.

public class WcfOperationContext : IExtension
    {
        private readonly IDictionary items;

        private WcfOperationContext()
        {
            items = new Hashtable();
        }

        public IDictionary Items
        {
            get { return items; }
        }

        public static WcfOperationContext Current
        {
            get
            {                
                WcfOperationContext context = OperationContext.Current.Extensions.Find();
                if (context == null)
                {
                    context = new WcfOperationContext();                    
                    OperationContext.Current.Extensions.Add(context);
                }
                return context;
            }
        }

        public void Attach(OperationContext owner) { }

        public void Detach(OperationContext owner) { }

    }]]></description>
		<content:encoded><![CDATA[<p>Found the solution &#8211; instead of using InstanceContext extension &#8211; use OperationContext extension. I think this is also more appropriate to what you meant.</p>
<p>public class WcfOperationContext : IExtension<br />
    {<br />
        private readonly IDictionary items;</p>
<p>        private WcfOperationContext()<br />
        {<br />
            items = new Hashtable();<br />
        }</p>
<p>        public IDictionary Items<br />
        {<br />
            get { return items; }<br />
        }</p>
<p>        public static WcfOperationContext Current<br />
        {<br />
            get<br />
            {<br />
                WcfOperationContext context = OperationContext.Current.Extensions.Find();<br />
                if (context == null)<br />
                {<br />
                    context = new WcfOperationContext();<br />
                    OperationContext.Current.Extensions.Add(context);<br />
                }<br />
                return context;<br />
            }<br />
        }</p>
<p>        public void Attach(OperationContext owner) { }</p>
<p>        public void Detach(OperationContext owner) { }</p>
<p>    }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shlomi</title>
		<link>http://blog.caraulean.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-28</link>
		<dc:creator><![CDATA[shlomi]]></dc:creator>
		<pubDate>Thu, 19 Mar 2009 13:14:03 +0000</pubDate>
		<guid isPermaLink="false">http://varely.wordpress.com/2008/02/13/httpcontext-idiom-for-windows-communication-foundation/#comment-28</guid>
		<description><![CDATA[What would you do if your WCF service is singleton?
(the items remains in the dictionary regardsless of the WCF request context, as in HttpContext).

Thanks,
Shlomi]]></description>
		<content:encoded><![CDATA[<p>What would you do if your WCF service is singleton?<br />
(the items remains in the dictionary regardsless of the WCF request context, as in HttpContext).</p>
<p>Thanks,<br />
Shlomi</p>
]]></content:encoded>
	</item>
</channel>
</rss>

