Coolthing Of Theday

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 11 April 2013

Unity vs. MEF - right for you, one is...

Posted on 14:57 by Unknown

Visual Studio Magazine - Unity vs. MEF: Picking the Right Dependency Injection Manager

Peter Vogel compares both of the Microsoft dependency injection managers/inversion of control containers and comes up with a decision tree for picking the correct one.

I think dependency injection containers make it so much easier to implement designs that include many dedicated objects that I'm not sure I could live without one anymore. Microsoft, though, provides two: the Managed Extensibility Framework (MEF), which is part of the Microsoft .NET Framework, and the Unity Container (Unity), which is available as a NuGet download. While there are also several open source tools available, these are the two that are easiest to add to your project. So the question is: Which should you use?

I've discussed MEF and Unity separately, but it's worthwhile to take the time to discuss what I like about each of them and when to use each. One caveat: Both tools are sufficiently "feature rich" that I'm almost certain to get something wrong. I hope comments on this article will address any glaring errors on my part.

First, an overview: Both tools allow you to define containers that you can load with classes or objects. Once you load a container with classes, both frameworks will instantiate the classes and hand you back the resulting objects. Both frameworks allow you to specify what values are to be passed to constructors or used to set properties and call methods when classes are instantiated. Both containers allow you to control the lifetime of those objects -- allowing you, for instance, to specify that only a single instance of some object is ever to be created (effectively implementing the singleton pattern).

...

Unity vs. MEF: The Decision Tree

...

The good news is both MEF and Unity are excellent tools, so neither is a bad choice. The bad news is, three months after picking one, you'll run into a problem that would've been easier to solve with the other tool.

image

Peter's closing sentence made me laugh out loud. So, so true.

Currently I'm on the Unity track as I'm building a Prism app, and it seemed the Unity extensions just felt more natural.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in .Net, DependencyInjection, Development, MEF, UnityApplicationBlock | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Mr. 7,000! This is my 7,000th post...
    Before this post; After; 20 visits between taking these snaps? Oh wait, that's probably me searching for past related posts....
  • "Windows Server Essentials Media Pack" (DNLA Stream, HTML5 and Dashboard Media stuff)
    Microsoft Downloads - Windows Server Essentials Media Pack This pack enables the media streaming functionality for Windows Server 2012...
  • Rad Gate Post... Get your Red Gate Post here...
    simple talk - Melanie Townsend - Get a copy of the Red Gate Post We recently put together a newspaper of some of the best articles fr...
  • Windows Management Framework 4.0 (PowerShell 4, PowerShell ISE, Management OData, WMI, etc.) now available
    Keith Hill's Blog - PowerShell 4.0 Now Available You can get PowerShell 4.0 for down level operating systems now via the WMF 4.0 d...
  • Viasfora - Your new favorite Visual Studio Text/*ML Editing Extension?
    Winterdom - Introducing Viasfora A couple of days ago, I unveiled Viasfora , my latest attempt at building a decently packaged extensi...
  • "Windows Server [2012 R2]: The Best Infrastructure to Run Linux Workloads"
    In the Cloud - What’s New in 2012 R2: Enabling Open Source Software Part 4 of a 9-part series . ... There are a lot of great s...
  • [Hardware Review] Life with Haswell... Haswell/Harris Beach Intel SDS Ultrabook Review - Part 2
    "So Greg, how's life with Haswell been?" "Pretty Sweet! (Mostly)" I've been given an opportunity to review t...
  • Fuzzy Lookup Add-In for Excel (Insert lame "Fuzzy, wuzzy was an Excel..." snip here)
    Microsoft Downloads - Fuzzy Lookup Add-In for Excel The Fuzzy Lookup Add-In for Excel performs fuzzy matching of textual data in Exce...
  • Caliburn.Micro v1.5.0 released (CM gets Tasks, Async/Await and Share/Setting for RT... and bug fixes of course)
    Caliburn.Micro - Caliburn.Micro v1.5.0 "Release Notes This release fixes many bugs. It also adds support for Task and async/a...
  • Just about everything you ever wanted to know about SQL Server Date and Time Data Types...
    CodeProject - Date and Time Data Types and Functions - SQL Server (2000, 2005, 2008, 2008 R2, 2012) Introduction It would be bette...

Categories

  • .Net
  • 3DPrinting
  • AFeedYouShouldRead
  • Agile
  • ALM
  • Amazon
  • Amiga
  • Analytics
  • Android
  • ASP.NET
  • Azure
  • BigData
  • bing
  • Blogging
  • Book
  • BookReview
  • BUILD
  • C
  • C#
  • C++
  • Career
  • Cat
  • cheatsheet
  • ClickOnce
  • Cloud
  • ComputerHardware
  • css
  • Data
  • DBA
  • DependencyInjection
  • Deployment
  • Design
  • Development
  • devops
  • DVCS
  • ebook
  • EDD
  • Education
  • EnterpriseLibrary
  • EntityFramework
  • Exchange
  • Expression
  • gadget
  • Game
  • GIT
  • Google
  • Government
  • Hadoop
  • hardware
  • HardwareReview
  • HaswellReview
  • HTML5
  • Humor
  • IE
  • IEExtension
  • IfAllElseFails
  • IIS
  • ILMerge
  • Image
  • Infographic
  • interview
  • InversionOfControl
  • Java
  • Javascript
  • Kinect
  • LightSwitch
  • LINQ
  • Linux
  • LosAngeles
  • Lucene
  • Lync
  • MEF
  • Metro
  • MicrosoftOffice
  • MicrosoftOutlook
  • Mono
  • MVC
  • MVVM
  • NetMon
  • NLP
  • NoSQL
  • NuGet
  • OData
  • OneNote
  • OpenXML
  • Paint.Net
  • Personal
  • Photosynth
  • Physics
  • portable
  • Poster
  • PowerShell
  • Preparedness
  • Presentation
  • Prism
  • PrivateCloud
  • RegEx
  • RemoteDesktop
  • Reporting
  • RIAServices
  • Science
  • ScienceFiction
  • Scratch
  • Scrum
  • ServiceBus
  • SharePoint
  • Silverlight
  • SimiValley
  • SPA
  • Space
  • SQLServer
  • Storyboard
  • Surface
  • SVG
  • SystemAdministration
  • T4
  • TeamBuild
  • TeamFoundationServer
  • TechEd
  • Training
  • TypeScript
  • UnitTesting
  • UnityApplicationBlock
  • Utility
  • Veteran
  • VirtualMachine
  • Visio
  • VisualBasic
  • VisualStudio
  • WCF
  • Web X.X
  • Webcast
  • WebFeed
  • WebMatrix
  • Windows
  • Windows7
  • Windows8
  • Windows8.1
  • WindowsHomeServer
  • WindowsLiveWriter
  • WindowsPhone
  • WindowsServer
  • WinRT
  • WiX
  • WMI
  • WOPI
  • WPF
  • XAML
  • XBox360
  • XboxOne
  • zombie

Blog Archive

  • ▼  2013 (500)
    • ►  December (12)
    • ►  November (61)
    • ►  October (65)
    • ►  September (38)
    • ►  August (47)
    • ►  July (75)
    • ►  June (39)
    • ►  May (40)
    • ▼  April (42)
      • Unusual Microsoft Download of the Day: "Cancelling...
      • Enterprise Library 6 and Unity 3 are out today... ...
      • NuGet your Enterprise?
      • Infragistics Releases 13.1 with new set of Windows...
      • Getting into the mood... (well...) Microsoft Resea...
      • Virtual CD-ROM Control Panel download - A granddad...
      • Public Sector Developer Weblog highlights a whole ...
      • The First [12] Steps in using Caliburn Micro to bu...
      • You are such a Code Digger... Code Digger VS2012 e...
      • I trace, you trace, we all IntelliTrace (or want t...
      • Example using the Task Parallel Dataflow Library h...
      • Learning Log Parser Studio in two parts... (From I...
      • "The Essential Binary Repository Management Cheat ...
      • Bye bye Kona code name... Hello "Prism for Windows...
      • 14 Minute cartooned video guide to to building you...
      • Just about everything you ever wanted to know abou...
      • TFS/Visual Studio 2012 Update 3 CTP 1 is available...
      • A view into the creation of NASA'a spaceappschalle...
      • The final final definitive (for now) answer for Wi...
      • Taking Facial Detection to the next level (and ful...
      • DevOps & IntelliTrace, better than beer and pizza ...
      • [Humor] "How to make an awesome illustration [for ...
      • What do Fiddler, LinqPad, Excel and SharePoint hav...
      • What would the Xbox 360 “Achievement Unlocked” sou...
      • Unity vs. MEF - right for you, one is...
      • Learning, living, being SQL Server for Dev's video...
      • Going with the GeoFlow for Excel 2013... Free 3D v...
      • Office Web Apps Server isn't just for SharePoint.....
      • "The Last Visibility Converter" (you'll ever need)
      • Microsoft Script Explorer - So long and thanks for...
      • Two Firsts, one great taste... A "Database-First C...
      • Community AdventureWorks on Azure one year later, ...
      • Powering your Zipping with PowerShell and 7-Zip (a...
      • WPF is to PowerShell as the PowerShell ISE is to E...
      • Nothing like a little LinqPad fun for a Friday - "...
      • DLM on MSDN - Database Lifecycle Management curate...
      • Visual Studio 2012 Update 2 is RTW... (and it's a ...
      • Dev'ing for Ops - How to create System Center Exte...
      • Scrum Primer, the v2...
      • Now that's Qool
      • Sql Server info tip of the day: Alter Columns - Kn...
      • Open Source NFC Emulator for Windows Phone 8 with ...
    • ►  March (39)
    • ►  February (42)
Powered by Blogger.

About Me

Unknown
View my complete profile