If you’ve heard anything about the new feature set of Visual Studio 2010 one of the game changing features for any developer is the Built in Extension Manager, this functionally is using MEF. What exactly is MEF? The Managed Extensibility Framework is as Framework for creating loosely-coupled, extensible applications. I am blogging this from the TechEd North America Session, When and Where to use MEF: Too much is never enough.
Where can I find MEF?
No MEF isn’t found in your local dark alley, and you don’t need to know a guy that knows a guy in order to use MEF. MEF is baked into the .NET framework comes out of the System.ComponentModel.Composition (2.0.5.0 for Silverlight, 4.0 for .NET 4.0) assembly.
Parts of MEF
Catalogs
A Catalog in terms of MEF is a class that contains metadata about your particular application so that it is able to pull in the particular Imports and Exports.
Exports
Exports in MEF are a way of exposing contracts to the framework when a particular class type is needed to be implemented into your application. This is useful when you need to use multiple implementations of an Interface to cover a particular task, like logging.
[Export[typeof(ILogger)]
public class RedGreenLogger
{
// Implement Class here
}
Imports
Imports in MEF is a way of stating that a concrete implementation is needed within the application. You will attribute a method with a particular importer when you would like MEF to fill in the blanks with an export or many exports for that particular task.
[ImportMany(typeof(ILogger)]
public List<ILogger>() Executors
{
// Add Implementation here
}
Containers
A container is a wrapper used to collect the Catalogs at a hi
public void Init(Executor e)
{
var container = new CompositionContainer(new DirectoryCatalog(Environment.CurrentDirectory));
container.SatifsyImportsOnce(e);
}
Composition
Composition is the piece of MEF that pulls all the parts of together. This is a call that you need to do explicitly, however depending on the implementation composition can be extremely easy or increasingly more difficult. When using Silverlight you can do this very simply by calling a method and passing the main page into the application and MEF runs automagically.
CompositionContainer.ComposeParts(this);
I can make a Living Application?
Due to the fact that you’re creating an abstracted [loosely-coupled] application, and how MEF can be used to create dynamically loaded components, you have the ability to use MEF to add new features to your application, or add additional functionality to your application without recompiling your application.
Thursday, 22 April 2010 18:20 by
SyntaxC4
Today I ventured down to the Scotia Theatre in downtown Toronto to witness another phenomenal “screening” of ObjectSharp’s “At the Movies” event which today featured many of the enhancements to Visual Studio 2010, and .NET 4. If I were a movie critic [which thankfully I am not], I wouldn’t have a clue what was going on. Luckily, I’m a Developer and give this presentation a rating of 5 ASP.NET AJAX Stars out of 5. This was not my first “At the Movies” event and by far won’t be my last, they just keep getting better!

Heading up the day of the SOLD OUT Show was a fantastic performance by Bruce Johnson with a High Level overview of the advancements in the .NET Realm. He covered the Managed Extensibility Framework (MEF) [with a cool extension to Visual Studio itself], Parallel Programming [with key points at enhancements in threading] with a Stellar example of “Work Stealing”, Code Contracting in .NET 4.0; and the integration of Azure and SQL Azure into Visual Studio.
After the break Paul Laberge of Microsoft Canada stunned the crowd with the awesome features of Expression Blend including the spectacular Prototyping tool Sketch Flow. The release of Silverlight 4 is one of the most influential since Silverlight 2 when the .NET Language was integrated into the Plug-in. Silverlight 4 now allows for Rich media usage like Web Cam & Microphone access, Native Multicasting, online and offline content protection; Rich User Experiences with support for Right-Click Context menus, Copy and Paste, and Google Chrome Integration. Furthermore, Silverlight 4 has entered into the World of Advanced Business Applications with new Printing Support, advanced Data binding support, a large library of Forms Controls, and Internationalization (Language Targeting).
Paul also did a demo to show how to utilize both Visual Studio 2010 & Expression Blend to separate the Developer and Designer Roles. “XAML is a Language that both your Developers and Designers can speak”, Paul explained, XAML creates a common ground so everyone is on the same page. Separating the Concerns in your project can allow a team to avoid software that ends up as depicted below.
Just before Lunch Angie Lim hit the stage to let Developers know that there are many ways in which Microsoft is trying to help. There are various “Spark” programs that give the tools businesses or developers need in order to be successful. Guelph Coffee and Code has a great post that explains each Spark Program, or you can ask for more in depth information from Angie.
After the Lobby cleared from the Lunch break, The crowd were wooed by the presentation styling of Barry Gervin and David Lloyd. Barry took the audience into a magical adventure, with an overview of the new Code Reporting, and Visualization features of Visual Studio 2010. These features offer Developers an easy visual representation of how the application functions, which could increase the speed of a learning curve when getting acquainted or re-acquainted with a legacy project.
David took to the stage to in full force covering the Bigger and Better Team Foundation Server. His demonstration featured an “advanced” calculator, focusing on unit testing, build automation, and Gated Check-ins. David reached out for his QA Specialist Debra Forsyth to run through a QA Cycle on his Calculator.
Debra ran through her test cycles by demoing the new Test & Lab Manager. Test Manager gives much more power to the QA teams, allowing them to Record test cases to gain a library of Automated tests. Debra made developers sweat when showing that there are no more “could not reproduce” excuses. Test Centre allows Quality Assurance testing to take screen shots, and even videos of each step of the testing process. With the advanced Testing Framework, and Lab management features of Visual Studio 2010 don’t be surprised to find many developers like this when you arrive at work in the morning:
To put the over 400 developers that attended the At the Movies session at ease, ObjectSharp broke out the Snacks and Energy Drinks. During the break the ObjectSharp staff went around engaging the crowd in personal chats. Barry Gervin came around to the group that I was in, here’s a picture of the chat also involving Sasha Krsmanovic from Telerik.
Next up Rob Windsor displays his passion for Sharepoint 2010 in front of the twitching crowd. Rob covers how Sharepoint has evolved, explaining the Architecture change in the massive Sharing and Collaboration Web Application. Rob then stepped into how the Development process has been nicely integrated into the Visual Studio 2010 IDE. Sharepoint 2010 has expanded even further allowing for consumption of List data in Console or WPF applications using WCF Data Services. I must apologize to Rob as I missed a good portion of his presentation, due to loosing track of time during the break.
Motoring through to the end of the day, Colin Bowern takes to the stage with an Electrifying presentation filled with Shocking imagery, Lightening fast code generation using Snippets. Colin outlined the new clean code that is generated in ASP.NET 4.0, contrasting the old method of Table based coding behavior and new List based html that “The rest of the development world has bee doing for sometime.” His example of the power of ASP.NET Routing, which began as a feature of MVC, can quickly and easily provide Search Friendly URLS to any existing Website without an abundance of code. He also showed the adoption of the jQuery library in Visual Studio 2010, and a quick example of the advance HTML Templates that can be used without any server code. Colin finished up by demonstrating some of the ASP.NET MVC framework and how the use of the framework gives a developer much more control over the html output.
As everyone [The smart ones that stuck around] awaited the prizes at the end of the day, that were provided by Microsoft Canada, Telerik, and Object Sharp. This gives you an idea of the size of the crowd that this free event pulls in. Make sure to keep your eyes open for next years event announcement!
| Tags: |
|
object sharp, .net, expression studio, expression blend, mef, parallel programming, code contracts, microsoft, sharepoint, wcf data services, telerik |
| Categories: |
|
Conferences | Technology Community |
| Actions: |
|
E-mail |
del.icio.us |
Permalink |
Comments (2) |
RSS
|