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 6921839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:19:42+00:00 2026-05-27T10:19:42+00:00

I am trying to implement the following situation: Import: private IEnumerable<ExportFactory<IPage, IPageMetadata>> _pageFactories =

  • 0

I am trying to implement the following situation:

Import:

private IEnumerable<ExportFactory<IPage, IPageMetadata>> _pageFactories = null;

[ImportMany("Page", typeof(IPage), AllowRecomposition = true)]
public IEnumerable<ExportFactory<IPage, IPageMetadata>> PageFactories
{
    get { return _pageFactories; }
    set { _pageFactories = value; }
}

Export:

[PartCreationPolicy(CreationPolicy.NonShared)]
[ExportPage(ModuleNames.Kiosk, "/Kiosk/CreateProject", typeof(IPage))]
public partial class ProjectView : IPage
{

}

Export Attribute:

public interface IPageMetadata
{
    String ModuleName { get; }
    String Version { get; }
    String RelativeUri { get; }
}

[MetadataAttribute]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true, Inherited = false)]
public class ExportPageAttribute : ExportAttribute
{
    private String _strModuleName = "";
    private String _strVersion = "0.0";

    private String _strRelativeUri = "";

    public ExportPageAttribute(String a_strModuleName, String a_strRelativeUri)
        : base("Page")
    {
        _strRelativeUri = a_strRelativeUri;
        _strModuleName = a_strModuleName;
    }

    public ExportPageAttribute(String a_strModuleName, String a_strRelativeUri, Type a_contractType)
        : base("Page", a_contractType)
    {
        _strRelativeUri = a_strRelativeUri;
        _strModuleName = a_strModuleName;
    }

    public String RelativeUri
    {
        get { return _strRelativeUri; }
        private set { _strRelativeUri = value;  }
    }

    public String ModuleName
    {
        get { return _strModuleName; }
        private set { _strModuleName = value; }
    }

    public String Version
    {
        get { return _strVersion; }
        set { _strVersion = value; }
    }
}

Container Creation:

 AssemblyCatalog assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
 AggregateCatalog aggregateCatalog = new AggregateCatalog(assemblyCatalog);

 CompositionContainer compositionContainer = new CompositionContainer(aggregateCatalog);

 CompositionHost.Initialize(compositionContainer);

When the PageFactories_set is called (which it is) the provided sequence is empty. The following does work though:

    private IPage[] _pages;

    [ImportMany("Page", typeof(IPage), AllowRecomposition = true)]
    public IPage[] Pages
    {
        get { return _pages; }
        set { _pages = value; }
    }
  • 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-27T10:19:43+00:00Added an answer on May 27, 2026 at 10:19 am

    Like so many times before, I figured out the answer soon after posting the question. I really do believe though that, had I not asked, I’d not have an answer now.

    The answer was with the AttributeUsageAttribute decorating my export attribute. I change it to the following, and it worked. I think it has something to do with the Inherited=false bit.

    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    

    Thanks me! 🙂

    De nada!

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

Sidebar

Related Questions

I am trying to implement the following regex search found on golfscript syntax page
I'm trying to implement a delegate class following Herb Sutter's Example . There is
i receive the following error when trying to implement auto-complete based on edismax type.
I'm trying to implement XOR in javascript in the following way: // XOR validation
I'm trying to implement my own GenericIdentity implementation but keep receiving the following error
I'm trying to implement autocomplete for a textbox using the following code, but it's
Now I am trying to implement High web site performance following YSlow rules. In
I'm trying to implement my first Spring MVC controller, following Spring documentation, some tutorials
I'm trying to implement http://github.com/bengottlieb/Twitter-OAuth-iPhone/tree/master into my code. I'm following the Demo provided and
I'm having the following issue in a WinForms app. I'm trying to implement Hotkeys

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.