Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6140703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:09:11+00:00 2026-05-23T18:09:11+00:00

From the official MEF documentation : A Composable Part should contain at least one

  • 0

From the official MEF documentation:

A Composable Part should contain at least one export.
Composable Parts are either added to the container explicity or created through the use of catalogs.
The default catalogs that MEF ship with identify Composable Parts through the presence of an export attribute.

Does this mean that this snippet form the same documentation would not work, when using the default catalogs, since it doesn’t export anything?

class Program
{
  [Import]
  public IMessageSender MessageSender { get; set; }
}

I find it hard to believe that all classes participating in the MEF mix, must all ‘bring food to the table’, even if they just want to ‘consume’.
The Program above being a simple example: there is nothing that this class could add to the MEF mix.

Secondly,
How are Parts being added “explicitly to the container”?
The documentation of e.g. CompositionContainer doesn’t help me any further.

Thanks in advance
Jan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:09:12+00:00Added an answer on May 23, 2026 at 6:09 pm

    A composable part is a part that can be imported into another part. The example here:

    class Program
    {
        [Import]
        public IMessageSender MessageSender { get; set; }
    }
    

    Program is not a composable part. It iself does not get automatically imported into another part. Your exports for IMessageSender are composable parts.

    You can add parts explicity to the container using a CompositionBatch, which allows you to add Export and ComposablePart instances to your container explicitly, or through extension you can add raw values:

    var user = new User() { Name = "Matt" };
    var batch = new CompositionBatch();
    batch.AddExportedValue(user);
    
    CompositionContainer.Compose(batch);
    

    Where the final call is adding your parts to the container.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is the table from the official MEF document Part.Any Part.Shared Part.NonShared Import.Any Shared
From the official documentation: A subclass of Dialog that can display one, two or
Quote from hib official docs: Starting with version 3.0.1, Hibernate added the SessionFactory.getCurrentSession() method.
I've downloaded the svntask for ant from tigris.org, so it is the official one.
From the official documentation I can't understand what is default parameter. obj, created =
I understand from the official documentation on unowned relationships that the app must use
I can't understand this line from the official documentation of mail function in PHP:
From the official documentation : Using the External Storage Every Android-compatible device supports a
I'm trying to compile the example from the official guide , the one with
From the official documentation: The reuse identifier is associated with a UITableViewCell object that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.