Questions tagged [mef2]

Microsoft Extensibility Framework (MEF) simplifies the design of extensible and modular applications.

Microsoft Extensibility Framework (MEF) simplifies the design of extensible and modular applications. Version 2 is available from .Net 4.5 and includes Dependency Injection.

30 questions
2
votes
0 answers

MEF2: Imports not found unless explicitly exported

I'm trying to get MEF2 attribute-less/convention-based registration working in my app. What I'm seeing is that if I omit the [Export] attribute, neither the ComposeParts call or GetExports call result in any items. If I add an…
MGB
  • 65
  • 2
  • 9
1
vote
1 answer

Create Singleton instance in MEF2

I'm creating an application with multiple plugins using MEF2 (Microsoft.Composition). These plugins should import some common object and they should all share the same instance of this object... so a typical Singleton. However, when I [Import] this…
TheHvidsten
  • 4,028
  • 3
  • 29
  • 62
1
vote
1 answer

.net core MEF 2 NonShared Creation Policy

I am switching over to .net core and attempting to migrate my legacy framework MEF code to the new Microsoft Composition (MEF 2) (Microsoft.Composition 1.0.31). We have several classes whose creation policy is "NonShared". I'm getting stuck on how…
Scott Software
  • 499
  • 2
  • 4
  • 17
1
vote
0 answers

How free blocked assemblies in MEF2 (System.Composition 1.0.31) in .NET Core

I wrote some codes : public interface IPlugin { string Name { get; set; } } ClassLibrary1.dll public class Class1 : IPlugin { public string Name { get; set; } = "Hamed Fathi"; } and a Console : public static void Main(string[] args) { …
NBM
  • 1,231
  • 4
  • 14
  • 18
1
vote
1 answer

How can you filter out parts in MEF2?

I'm trying to port some code from targeting the .NET Framework to .NET Core, and part of this involves switching from MEF1 to MEF2. There doesn't seem to be a great deal of documentation on using MEF in .NET Core, and I can't find any examples…
Tagc
  • 8,736
  • 7
  • 61
  • 114
1
vote
0 answers

MEF2: importing all the types implementing a specific interface

I'm trying to create a simple plugin system using MEF2. In my scenario I'll have only 1-10 plugins, so I decided not to bother about loading assemblies in a separate domain to avoid performance issues; this would be nice anyway, but it seems it…
Naftis
  • 4,393
  • 7
  • 63
  • 91
1
vote
1 answer

MEF 2 - Where is RegistrationBuilder

I am completely confused this evening. I've read almost a dozen posts on how to use the RegistrationBuilder in MEF 2 to build the Composition Context. However, there's no such class in the MEF 2 that I loaded down to build WinRT applications. Can…
Quark Soup
  • 4,272
  • 3
  • 42
  • 74
1
vote
1 answer

MEF DirectoryCatalog reads the same dll many times

I had a simple implementation of MEF loading some dlls (plugins) from a directory. This was running well under MEF1 but now I want to use the same functionality with MEF2 and it gives me an IEnumerable that contains the right count of dlls that are…
Perrier
  • 2,753
  • 5
  • 33
  • 53
0
votes
1 answer

MEF2 Lightweight System.Composition with Metadata

The complete lack of examples for how to use lightweight MEF2, System.Composition, makes this tricky. I am only using System.Composition (not System.ComponentModel.Composition). I want to import parts that have metadata. I'm using attributed code.…
Boggin
  • 3,251
  • 3
  • 33
  • 48
0
votes
2 answers

MEF With Portable Class library using Microsoft Composition MEF2 throws file not found exception

I am working on Portable Class Library(PCL) and trying to achieve MEF in that. I used System.Composition from Nuget. When i build and package for vsix (Extension for Visual Studio) it doesn't package and place those dll's to extension…
shekhar Kumar
  • 409
  • 4
  • 13
0
votes
1 answer

How Can I Export a Factory and/or its Method in MEF 2?

I am looking into MEF 2 (Microsoft.Composition) and am looking to integrate it with my existing code base. My current codebase has an IFactory interface with a simple signature: public interface IFactory { T Create(); } I would like to…
Mike-E
  • 2,477
  • 3
  • 22
  • 34
0
votes
1 answer

how can i mimic the inheritedexport feature in mef2

I'm using MEF2 and read a couple of tutorials on MEF 1 and MEF 2. The best one i've found so far is this one: http://www.codeproject.com/Articles/366583/MEF-Preview-Beginners-Guide While i did get exports to work just fine, i really want to do it…
Dbl
  • 5,634
  • 3
  • 41
  • 66
0
votes
1 answer

How to install/get started with MEF 2

I want to use MEF 2 in a project. I'm trying to follow this guide to get started, but I cannot seem to get even the first snippet of code to run. The RegistrationBuilder simply doesn't exist and I don't seem to have the…
Kat
  • 4,645
  • 4
  • 29
  • 81
0
votes
1 answer

Microsoft.Composition. What does the WithDefaultConventions method do?

Supposing I have a method GetAssemblies, which returns a list of assemblies, and a method called GetConventions, which returns a ConventionBuilder, I might compose my container like this: CompositionHost container = new ContainerConfiguration() …
bornfromanegg
  • 2,826
  • 5
  • 24
  • 40
0
votes
1 answer

Good examples of MEF2 imports

I've used MEF before, but am having problems now with the newer implementation. I'm exporting objects inheriting from a base class, that has the [InheritedExport] attribute, and am trying to get them imported. Before, I would just have an array…
Random
  • 1,896
  • 3
  • 21
  • 33
1
2