Friday, May 14, 2010

Inject Some Life into Your Applications—Getting to Know the Unity Application Block

http://msdn.microsoft.com/en-us/library/ff650806.aspx


IoC and the Unity Application Block - Going Deeper

http://weblogs.asp.net/podwysocki/archive/2008/02/22/ioc-and-the-unity-application-block-going-deeper.aspx

(...)
Update: Fixed code changed from CTP and More in the series:
IoC and Unity - The Basics and Interception
IoC and the Unity Application Block Once Again
IoC Containers, Unity and ObjectBuilder2 - The Saga Continues
IoC Container, Unity and Breaking Changes Galore
(...)

Unity Dependency Injection IoC Screencast

http://www.pnpguidance.net/Screencast/UnityDependencyInjectionIoCScreencast.aspx
(...)
Unity IoC Screencast
The Unity Dependency Injection / IoC Container is new from Microsoft Patterns and Practices. It will come in both a stand-alone version and bundled within Enterprise Library 4.0 as an alternate configuration mechanism for the application blocks. This screencast shows several common usages of Unity as well as how to use Unity with both the ASP.NET MVC Framework and with ASP.NET Webforms using Model-View-Presenter.

The screencast highlights:

ASP.NET MVC Framework.
ASP.NET Model View Presenter Pattern.
UnityContainer Resolve and BuildUp Methods
UnityContainer RegisterType and RegisterInstance Methods
UnityConfigurationSection for Web.config and App.config
(...)

Automatic Factories in Unity 2 - Unity 2 Tutorials and Samples

http://www.davidhayden.me/2010/01/automatic-factories-in-unity-2-unity-2-tutorials-and-samples.html
(...)
In Unity 2 there is the concept of Automatic Factories to allow classes or services to defer instantiation of their dependencies to the last possible moment. This is particularly useful when the dependency is expensive to create and is not always used by the service. Think of it as lazy loading of dependencies just like we have lazy loading in O/R Mappers.

I mentioned similar functionality in Autofac in the following tutorial: Auto-Generated Factories in Autofac for Lazy Instantiation - LazyDependencyModule. I recommend you read that tutorial as it talks more about the concepts, etc., whereas here I will only mention a few comments and show you an example. Autofac also goes a bit further than Unity 2 by supporting Lazy and Lazy when using Autofac with the .NET Framework 4.
(...)

Microsoft Unity 2.0 – April 2010

http://msdn.microsoft.com/en-us/library/ff663144.aspx
(...)
What Does Unity Do? This topic provides a brief overview that will help you to understand what Unity can do, and explains some of the concepts and features it incorporates. It also provides a simple example of the way that you can write code to use Unity.
When Should I Use Unity? This topic will help you to decide if Unity is suitable for your requirements. It explains the benefits of using Unity, and any alternative techniques you may consider. It also provides details of any limitations of Unity that may affect your decision to use it.
About This Release of Unity. This topic contains information about the changes in this release, the target audience and system requirements, migration and side-by-side execution, and links to other Microsoft patterns & practices resources.
Configuring Unity. This topic describes how you can populate a Unity container with the type registrations, mappings, extensions, and other information required by your application.
Using Unity in Applications. This topic explains how to use Unity in your own applications. It explains how to add Unity to your application, how to resolve objects, and how to take advantage of the many other capabilities of Unity.
Design of Unity. This topic explains the decisions that went into designing Unity and the rationale behind those decisions.
Extending and Modifying Unity. This topic explains how to extend Unity and how to modify the source code.
Deployment and Operations. This topic explains how to deploy and update the Unity assemblies and use the instrumentation exposed by Unity.
(...)

Dependency Inversion Principle

http://blogs.developpeur.org/tja/archive/2010/02/10/design-patterns-partie-2-dip-dependency-inversion-principle.aspx
(...)
What Does Unity Do? This topic provides a brief overview that will help you to understand what Unity can do, and explains some of the concepts and features it incorporates. It also provides a simple example of the way that you can write code to use Unity.
When Should I Use Unity? This topic will help you to decide if Unity is suitable for your requirements. It explains the benefits of using Unity, and any alternative techniques you may consider. It also provides details of any limitations of Unity that may affect your decision to use it.
About This Release of Unity. This topic contains information about the changes in this release, the target audience and system requirements, migration and side-by-side execution, and links to other Microsoft patterns & practices resources.
Configuring Unity. This topic describes how you can populate a Unity container with the type registrations, mappings, extensions, and other information required by your application.
Using Unity in Applications. This topic explains how to use Unity in your own applications. It explains how to add Unity to your application, how to resolve objects, and how to take advantage of the many other capabilities of Unity.
Design of Unity. This topic explains the decisions that went into designing Unity and the rationale behind those decisions.
Extending and Modifying Unity. This topic explains how to extend Unity and how to modify the source code.
Deployment and Operations. This topic explains how to deploy and update the Unity assemblies and use the instrumentation exposed by Unity.
(...)

Enterprise Library 4.0 Logging Application Block and Unity IoC Screencast

http://www.pnpguidance.net/Post/EnterpriseLibrary4LoggingApplicationBlockUnityIoCScreencast.aspx
(...)
Enterprise Library 4.0 Logging Application Block with Unity IoC Integration Screencast
A new screencast showing off the use of the Enterprise Library 4.0 Logging Application Block using the EnterpriseLibraryCoreExtension and LoggingBlockExtension that provide Unity IoC Integration. It shows one how to register the Logging Application Block LogWriter Class and how Unity injects the LogWriter Class into your own custom classes.

The screencast highlights:

Enterprise Library 4.0 Logging Application Block.
Unity IoC.
EnterpriseLibraryCoreExtension.
LoggingBlockExtension.
UnityContainer
Injecting LogWriter Classes into Custom Classes.
(...)

Thursday, May 13, 2010

Using Unity Application Block – from basics to generics

http://weblogs.asp.net/nmarun/archive/2010/05/05/using-unity-application-block-from-basics-to-generics.aspx
(...)
Part 1: The very basics – Begin using Unity (code here)

Part 2: Registering other types and resolving them (code here)

Part 3: Lifetime Management (code here)

Part 4: Constructor and Property or Setter Injection (code here)

Part 5: Arrays (code here)

Part 6: Generics (code here)
(...)

Demystifions Unity Application Block

http://marc-chouteau.blogspot.com/2009/01/demistifions-unity-application-block.html
(...)
Unity est un conteneur léger qui permet de réaliser de l’inversion de controle au niveau de l’architecture des applications

La dernière version téléchargeable est la version 1.2 que l’on peut trouver ici : http://www.codeplex.com/unity, c’est un bloc d’application de la libraire d’entreprise de Microsoft V4.1 et peut etre téléchargé individuellement.
(...)

Unity 2.0 download from MSDN

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=2d24f179-e0a6-49d7-89c4-5b67d939f91b

IoC and Unity - The Basics and Interception

http://weblogs.asp.net/podwysocki/archive/2008/03/25/ioc-and-unity-the-basics-and-interception.aspx

Tame Your Software Dependencies for More Flexible Apps

http://msdn.microsoft.com/en-ca/magazine/cc337885.aspx
(...)
The Inner Dependency Problem
Dependency Inversion
Dependency Injection
Containers
Full-Fledged IoC Containers
Lifetime Management
Auto-Wiring Dependencies
Loosen Up for a Change
(...)

A First Look at Unity 2.0

http://dotnetslackers.com/articles/net/A-First-Look-at-Unity-2-0.aspx

AOP and Unity - InterfaceInterceptor Example - Unity Dependency Injection Tutorials

http://www.pnpguidance.net/Post/AOPUnityInterfaceInterceptorExampleUnityDependencyInjectionTutorials.aspx

Application Design Concepts with Unity

http://msdn.microsoft.com/en-us/library/ff660926(v=PandP.20).aspx

What Does Unity Do?

http://msdn.microsoft.com/en-us/library/ff660864(PandP.20).aspx

Generic Decorator Chains Example using Unity Dependency Injection Container

http://www.pnpguidance.net/post/GenericDecoratorChainsExampleUnityDependencyInjectionContainer.aspx

IMPLÉMENTER FACILEMENT INOTIFYPROPERTYCHANGED

http://www.csharpfr.com/codes/IMPLEMENTER-FACILEMENT-INOTIFYPROPERTYCHANGED_44333.aspx

Castle Dynamic Proxy tutorial

http://kozmic.pl/archive/2009/04/27/castle-dynamic-proxy-tutorial.aspx

Introduction to the Policy Injection Application Block

Python use decorators to pre and post actions when calling a function.
Here is a way to do it in .Net
http://msdn.microsoft.com/en-us/library/ff648328(v=PandP.10).aspx

Another library : Castle Project
http://www.castleproject.org/dynamicproxy/index.html