At the Tampa C# Meetup on August 3rd, I presented this Gentle Introduction to MEF using the same project modified over three steps. This is Part Two, where I show the application created in MEF.
Recap In Part One I created an application the generates some text, and transforms it based on a selected transformation method. We introduced the following interfaces:
IGenerator – implemented by our text generators ITransformer – implemented by our transformers
At the Tampa C# Meetup on August 3rd, I presented this Gentle Introduction to MEF using the same project modified over three steps. This is Part Three, where I complete the application created in Part One and modified to use MEF in Part Two. This part will show MEF composing the application from multiple assemblies into one application at run time.
Recap In Part One I created an application the generates some text, and transforms it based on a selected transformation method.
At the Tampa C# Meetup on August 3rd, I presented this Gentle Introduction to MEF using the same project modified over three steps. This is part one, where I show the application without MEF.
Functionality The target program will have the following functionality:
Transform text data using a selectable transformation method Generate source data (in case the user is too lazy to type something in) Clear the source and destination text blocks Text generation and transformation must be pluggable strategies for future expansion
A few years ago I wrote Type Tracking Extension for Unity and Extending and Demonstrating the Type Tracking Extension for Unity, and while I have been using Autofac more, I felt this code was due for a slight update. Given the ease of creating a NuGet package for Caliburn.Micro.Autofac (see Introducing Caliburn.Micro.Autofac), I thought that I could give some Nuget love to the Type Tracking Extension for Unity.
What’s Changed Obviously, if I am working on some changes, I might as well bring the code up to date.
In my recent post, IoC Challenge – Multiple interfaces to the same singleton instance, I posted an IoC challenge to the community. I also mentioned that on the Ninject discussion groups, a suggestion was posted on how to solve this using Ninject.
Today, I decided to try out that suggestion, and I have to admit, it is quite elegant so far. Here is the source code used.
First, the interfaces.
I have an IoC challenge that I am currently trying to work through. I have a series of classes that implement more than one interface, with the lifetime of the class needing to be a singleton, and I really don’t like the idea of falling back on custom instantiation code along with potentially custom lifetime management code to make this work.
Sound confusing? Here is the model I am trying for.