ArticleslgStudy

computer science

Managed Extensibility Framework

Managed Extensibility Framework is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Managed Extensibility Framework rather than just read about it. In short: Managed Extensibility Framework (MEF) is a component of .NET Framework 4.0 aiming to create lightweight, extensible applications. It aims to allow .NET application developers to discover and use extensions with no configuration required.

Managed Extensibility Framework — main illustration
Managed Extensibility Framework — illustration

Key takeaways

  • Managed Extensibility Framework belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Managed Extensibility Framework to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Managed Extensibility Framework from memory before moving on to harder problems.

Reference excerpt

Managed Extensibility Framework (MEF) is a component of .NET Framework 4.0 aiming to create lightweight, extensible applications. It aims to allow .NET application developers to discover and use extensions with no configuration required. It also aims to let extension developers encapsulate code easily and avoid fragile hard dependencies. Furthermore, it aims to allow extensions to be reused across applications. MEF was introduced as a part of .NET 4.0 and Silverlight 4. It was later improved with the release of .NET 4.5 by adding support for generic types and the introduction of a convention-based extension model.

Overview MEF aims to solve the runtime extensibility problem. Without MEF, any application that wants to support a plugin model needs to create its own infrastructure from scratch. Those plugins will often be application-specific and cannot be reused across multiple implementations.

MEF aims to provide a standard way for the host application to expose itself and consume external extensions. Extensions, by their nature, could be reused amongst different applications. However, an extension can still be implemented in a way that is application-specific. Extensions themselves can depend on one another and MEF aims to make sure they are wired together in the correct order, sparing the developer from doing it manually. MEF offers a set of discovery approaches for the application to locate and load available extensions. MEF allows tagging extensions with additional metadata which aims to facilitate rich querying and filtering.

Design Roughly speaking, MEF's core consists of a catalog and a CompositionContainer. A catalog is responsible for discovering extensions and the container coordinates creation and satisfies dependencies.

MEF's first-class citizen is the ComposablePart class. A composable part offers up one or more Exports, and may also depend on one or more externally provided services or Imports. A composable part also manages an instance, which can be an object instance of a given type (it is in the default MEF implementation). MEF, however, is extensible and additional ComposablePart implementations can be provided as long as they adhere to the Import/Export contracts. Exports and imports each have a Contract. Contracts are the bridge between exports and imports. An export contract can consist of further metadata that can be used to filter on its discovery. For example, it might indicate a specific capability that the export offers. MEF's container interacts with Catalogs to have access to composable parts. The container itself resolves a part's dependencies and exposes Exports to the outside world. Composable part instances may be added directly to the container. A ComposablePart returned by a catalog will likely be an extension to the application. It might have Imports (dependencies) on components the host application offers, and it's likely to Export others. The default MEF composable part implementation uses attribute-based metadata to declare exports and imports. This allows MEF to determine which parts, imports, and exports are available through discovery.

References

Further reading Likness, Jeremy (2011). Fundamentals of the Managed Extensibility Framework (MEF). Addison-Wesley. ISBN 978-0132929400. Verma, Rishabh (2020). Visual Studio Extensibility Development: Extending Visual Studio IDE for Productivity, Quality, Tooling, and Analysis. Apress. ISBN 978-1484258538. Harris, Alan (2010). Pro ASP.NET 4 CMS: Advanced Techniques for C# Developers Using the .NET 4 Framework. Apress. ISBN 978-1430227137. Nagel, Christian; Evjen, Bill; Glynn, Jay; Watson, Karli; Skinner, Morgan (2010). Professional C# 4.0 and .NET 4. John Wiley & Sons. ISBN 978-0470632536.

External links

mef on GitHub Managed Extensibility Framework Overview Building Composable Apps in .NET 4 with the Managed Extensibility Framework Gentle Introduction to MEF - Part One

Worked examples

Example 1 — a first encounter with Managed Extensibility Framework

Start with the simplest possible case. Write down what Managed Extensibility Framework claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Managed Extensibility Framework before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Managed Extensibility Framework ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Managed Extensibility Framework

In research
Managed Extensibility Framework appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Managed Extensibility Framework in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Managed Extensibility Framework is common in secondary-school and first-year university syllabi. It links to neighbouring topics .NET Framework terminology, 2010 software, C Sharp libraries, so understanding it makes those chapters shorter.
In everyday life
Look for Managed Extensibility Framework outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Managed Extensibility Framework” →

How to study Managed Extensibility Framework in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Managed Extensibility Framework means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Managed Extensibility Framework out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Managed Extensibility Framework in simple terms?

Managed Extensibility Framework (MEF) is a component of .NET Framework 4.0 aiming to create lightweight, extensible applications. It aims to allow .NET application developers to discover and use extensions with no configuration required.

Why does Managed Extensibility Framework matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Managed Extensibility Framework?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Managed Extensibility Framework.

Tags

  • .NET Framework terminology
  • 2010 software
  • C Sharp libraries
  • Microsoft free software
  • Software using the MIT license
  • Windows-only free software

Keep exploring