<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/3.3.1" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Nicolas Penin - Latest comments on Concrete Singleton pattern implementation in .NET</title>
		<link>http://www.dotnetguru2.org/nicolaspenin/index.php?disp=comments</link>
		<atom:link rel="self" type="application/rss+xml" href="http://www.dotnetguru2.org/nicolaspenin/index.php?tempskin=_rss2&#38;disp=comments&#38;p=995" />
		<description></description>
		<language>en-US</language>
		<docs>http://backend.userland.com/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=3.3.1"/>
		<ttl>60</ttl>
				<item>
			<title>Steve Degosserie [Visitor] in response to: Concrete Singleton pattern implementation in .NET</title>
			<pubDate>Fri, 16 Jan 2009 10:14:39 +0000</pubDate>
			<dc:creator>Steve Degosserie [Visitor]</dc:creator>
			<guid isPermaLink="false">c6330@http://www.dotnetguru2.org/</guid>
			<description>Hello Nicolas,&lt;br /&gt;
&lt;br /&gt;
Interesting approach but as Yann said, you should have a look at how IoC Containers deal with such things as lifecycle, lifestyle, component activation ... Castle Windsor being a great example of those principles dealt with in a loosely-coupled fasion.</description>
			<content:encoded><![CDATA[Hello Nicolas,<br />
<br />
Interesting approach but as Yann said, you should have a look at how IoC Containers deal with such things as lifecycle, lifestyle, component activation ... Castle Windsor being a great example of those principles dealt with in a loosely-coupled fasion.]]></content:encoded>
			<link>http://www.dotnetguru2.org/nicolaspenin/index.php/2009/01/14/concrete_singleton_pattern_implementatio#c6330</link>
		</item>
				<item>
			<title>Nicolas Penin [Member] in response to: Concrete Singleton pattern implementation in .NET</title>
			<pubDate>Wed, 14 Jan 2009 13:14:00 +0000</pubDate>
			<dc:creator>Nicolas Penin [Member]</dc:creator>
			<guid isPermaLink="false">c6324@http://www.dotnetguru2.org/</guid>
			<description>Thanks for taking time to comment my post. You're right, I'm not making enough locks, but I did not say that this implementation was perfect for everything. It would work in most of cases because, in ASP.NET or WCF, you almost never use a singleton from other threads, if you do, this is an application lifecycle, and in that case, The lock is there to prevent any issue.&lt;br /&gt;
&lt;br /&gt;
You're also right for the hard coded dependencies. What I assumed and did not explained is that this class is supposed to be used in a base class library. So you are not supposed to have any issue with this because these libraries (system.web and system.servicemodel) are both in the GAC).</description>
			<content:encoded><![CDATA[Thanks for taking time to comment my post. You're right, I'm not making enough locks, but I did not say that this implementation was perfect for everything. It would work in most of cases because, in ASP.NET or WCF, you almost never use a singleton from other threads, if you do, this is an application lifecycle, and in that case, The lock is there to prevent any issue.<br />
<br />
You're also right for the hard coded dependencies. What I assumed and did not explained is that this class is supposed to be used in a base class library. So you are not supposed to have any issue with this because these libraries (system.web and system.servicemodel) are both in the GAC).]]></content:encoded>
			<link>http://www.dotnetguru2.org/nicolaspenin/index.php/2009/01/14/concrete_singleton_pattern_implementatio#c6324</link>
		</item>
				<item>
			<title>yann schwartz [Visitor] in response to: Concrete Singleton pattern implementation in .NET</title>
			<pubDate>Wed, 14 Jan 2009 11:30:50 +0000</pubDate>
			<dc:creator>yann schwartz [Visitor]</dc:creator>
			<guid isPermaLink="false">c6321@http://www.dotnetguru2.org/</guid>
			<description>There are several issues with your sample. &lt;br /&gt;
First, the class is not thread safe (you're not locking much and in some cases the singleton can be created several times). &lt;br /&gt;
&lt;br /&gt;
The static event is a synchronisation failure waiting to happen (no lock on add-remove... nasty things may happen if a subscriber unsubscribes just before you raise CreateInstance).&lt;br /&gt;
&lt;br /&gt;
This implementation also have hard coded dependencies on system.web.dll (asp.net) and system.servicemodel.dll (wcf) which makes it very context specific.&lt;br /&gt;
&lt;br /&gt;
Furthermore, singletons with different lifestyles (i.e. different lifecycles) are mostly a problem solved now if you use any decent IoC framework (see lifestyles in Castle Windsor for instance).</description>
			<content:encoded><![CDATA[There are several issues with your sample. <br />
First, the class is not thread safe (you're not locking much and in some cases the singleton can be created several times). <br />
<br />
The static event is a synchronisation failure waiting to happen (no lock on add-remove... nasty things may happen if a subscriber unsubscribes just before you raise CreateInstance).<br />
<br />
This implementation also have hard coded dependencies on system.web.dll (asp.net) and system.servicemodel.dll (wcf) which makes it very context specific.<br />
<br />
Furthermore, singletons with different lifestyles (i.e. different lifecycles) are mostly a problem solved now if you use any decent IoC framework (see lifestyles in Castle Windsor for instance).]]></content:encoded>
			<link>http://www.dotnetguru2.org/nicolaspenin/index.php/2009/01/14/concrete_singleton_pattern_implementatio#c6321</link>
		</item>
			</channel>
</rss>
