Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
DZone MVB

Links

Social

Unity and singletons

I just putted up Unity behind my test project and had some troubles with singletons. There is some misleading information in documentation you should be aware of. I created one class and one interface, both in same project to save some time.

 

NB! This blog is moved to gunnarpeipman.com

Click here to go to article

Comments

uTILLIty said:

yes, I thought I had it working with "singleton" and suddenly I got errors. Thanks for the quick "point in the right direction"

# July 24, 2008 9:40 AM

uTILLIty said:

BTW: if you wanted to use the alias, just register it in the unity config-section:

<typeAliases>

 <typeAlias alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />

</typeAliases>

# July 24, 2008 9:44 AM

Enrico said:

Thanks for this hint.

My XML just looks like:

<register type="..." mapTo="...">

 <lifetime type="..."/>

</register>

what is the functional difference here to your xml using type nodes, not register nodes?

(i am very new to unity, so sorry if thats a trivial question)

greets

Enrico.

# August 9, 2011 10:35 AM