Quantcast
Channel: Managed Extensibility Framework
Viewing all 265 articles
Browse latest View live

New Post: MEF 1 + nHibernate + Fluent NHibernate - Cannot cast (ContractName=“NHibernate.ISession”)' to type 'NHibernate.ISession'

$
0
0
I've been wrestling with this issue for about two weeks now and have cut it back to one very specific test. I've asked this question on StackOverflow but haven't had any helpfull replies as yet.

Please note I cannot use .Net 4.5 due to customers operating systems.

Bascially I've got a session factory class which imports the fluent configuration and exports new NHibernate ISessions through a function with the attribute [Export(typeof(ISession))].

The code for this class is as follows:
[Export(typeof(SessionFactoryMock))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class SessionFactoryMock
{
    private readonly ISessionFactory sessionFactory;        

    public SessionFactoryMock()
    {
        sessionFactory =
                Fluently.Configure()
                .Database(
                    MsSqlConfiguration.MsSql2008.ConnectionString(c => c
                        .Server(@".\SQLExpress")
                        .Database("Test")
                        .TrustedConnection()))
                .Mappings(configuration => configuration.FluentMappings.Add<TestEntityMap>())
                .ExposeConfiguration(c => new SchemaExport(c).Execute(true, true, false))                    
                .BuildSessionFactory();            
    }

    [Export(typeof(ISession))]
    public ISession GetSession()
    {
        return sessionFactory.OpenSession();
    }
}
And I'm using the following test to see if I can get a session from the session factory:
[TestMethod]
public void CanGetISession()
{
    Assembly executing = Assembly.GetExecutingAssembly();
    var cat = new AggregateCatalog(new[]
        {
            new AssemblyCatalog(executing)
        });

    var container = new CompositionContainer(cat);

    var batch = new CompositionBatch();
    batch.AddExportedValue(container);

    container.Compose(batch);

    var compositionInfo = new CompositionInfo(cat, container);
    using (var stringWriter = new StringWriter())
    {
        CompositionInfoTextFormatter.Write(compositionInfo, stringWriter);
        string compositionDetail = stringWriter.ToString();
        bool errorDetected = compositionDetail.Contains("[Primary Rejection]");

        if (errorDetected)
        {
            Assert.Fail(compositionDetail);
        }
    }

    var export = container.GetExport<ISession>();
    var exportedValue = export.Value;
    Assert.IsNotNull(exportedValue);
}
This test will continually fail with the message:

System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'MefnHibernateFail.SessionFactoryMock.GetSession (ContractName="NHibernate.ISession")' to type 'NHibernate.ISession'.

Which is extremely unhelpful.

I'm building all the Fluent nHibernate and NHibernate libraries from code and I have an example solution.

I'm really hoping someone can shed some light on this because I'm pretty much at a dead end now. The only way forward I can see is to pull out MEF and use another IOC framework.

Full source code can be found here: Example Solution

New Post: Using network drives with MEF

$
0
0
Hi!

I had the same issue and added in the app.config the following code:
<runtime>
    <loadFromRemoteSources enabled="true"/>
  </runtime>
Things are working fine when accessing a Mapped networked place (e.g. x:\MyPluggins).
However, it fails when I specify the full path (e.g. \MyServer\MyPluggins) and I can't find why.

New Comment on "Debugging and Diagnostics"

$
0
0
Hi I would like to log the composition but i cannot find CompositionInfo or CompositionInfoTextFormatter. In what namespace are they located? I am using .net 4 VS 2012.

New Comment on "What is Microsoft.Composition?"

$
0
0
Windows Store App Class Libraries doesn't have the typeof(X).Assembly property!

New Post: Azure Worker Role and MEF Open Generics

$
0
0
Hi there
I have very strange problem, the open generics exports are not discovered by assembly catalog when working under Microsoft Azure Worker role.

The assembly catalog didn't see the open generic export while it can see ordinary non generic exports just fine.

Otherwise when exporting from web role, the open generic export discovered and imported without any problem.

When switched the MEF from .Net framework 4.5 built in MEF 2.0 to Microsoft.Composition 2.0 from nuget, the open generic export working just fine.

Any clue why this happen with MEF 2.0?
Is this something related to Azure worker roles, or limitation in MEF 2.0 library itself?

I attached a test cloud project to show the problem. To run the project you will need VS 2012 and Azure SDK 2.0

Project Link

New Post: Well-Known Boundaries

$
0
0
What's the deal with Microsoft.Composition.Demos.Web.Mvc.Boundaries?

It says it defines [w]ell-known sharing boundary names. The composition provider uses all of these when handling a web request and then goes on to define three:
// The boundary within which a
// current HTTP request is accessible.
public const string HttpRequest = "HttpRequest";

// The boundary within which a
// consistent view of persistent data is available.
public const string DataConsistency = "DataConsistency";

// The boundary within which a
// single user can be identified.
public const string UserIdentity = "UserIdentity";
As far as I can tell, these aren't "well-known" to anything, and at the end of the day they're all per-request care of CompositionProvider.CurrentInitialisedScope leaning on HttpContext.Current.

Which is to say, they might as well be called PerRequestBoundary1, PerRequestBoundary2, and PerRequestBoundary3.

Boundaries.cs hints at as much with: The composition provider uses all of these when handling a web request.

But basically it looks like everything but HttpRequest are misnomers: there's nothing about the string "UserIdentity" that actually links a part's lifetime to the request's user identity.

New Post: Well-Known Boundaries

$
0
0
I agree with you.
The string themselves are not important, what is important is the creation and destroy of CompositionContext.
You can see the code for library called alt-composition written by nblumhardt who was on the MEF team.
Specifically I suggest to look at MvcCompositionProvider.cs Line 34 where he creates a CompositionContract with the specified boundaries. As far as I can tell all those boundaries are exactly the same (as you said).

At line 65 you can see how he try to get exist composition context or creates new one and store it.

I am using this library and it works great but I think Google Guice Scopes are much clearer. I look at Guice because I find a lot of similarities between MEF and Guice and the both accomplish similar goals.

Ido

New Post: Well-Known Boundaries

$
0
0
ido_ran wrote:
You can see the code for library called alt-composition written by nblumhardt who was on the MEF team.
Thanks for the reference, I'll check out the source.

Created Unassigned: silverlight for MEF [14610]

$
0
0
Hello
i was chacking this article:

http://msdn.microsoft.com/en-us/library/ms171868(v=vs.110).aspx#core

and i was not able to see any information about Silverlight, mainly related to PRISM interactions and so on.

ther is some development in this area?


Thanks


Edited Unassigned: silverlight for MEF [14610]

$
0
0
Hello
i was checking this article:

http://msdn.microsoft.com/en-us/library/ms171868(v=vs.110).aspx#core

and i was not able to see any information about Silverlight, or also inside PRISM, etc.

theer is some development in this area?


Thanks


New Post: Resolving Open Generics with RegistrationBuilder

$
0
0
We are using MEF2 RegistrationBuilder.ForTypesMatching as provided as a solution above for exporting the types from a class library. I have attached the sample code below. This is working fine before updating the system with the Microsoft update KB2840642v2. But is not exporting any parts after updated the system with the update KB2840642v2. One thing we noticed is that it is not working when I put this code in Global.asax.cs. But the code is working fine on a console application. The same issue is there on .net 4.5 and .net 4.5.1. Tested the same result on Visual Studio 2012 and Visual Studio 2013.

Looking for a fix or workaround for this.
  using HandlerModule;
  using System;
  using System.ComponentModel.Composition;
  using System.ComponentModel.Composition.Hosting;
  using System.ComponentModel.Composition.Registration;
  using System.Reflection;
  using System.Web.Hosting;

  namespace WebApplication1
  {
public class Global : System.Web.HttpApplication
{
    private const string TaskServices = "HandlerModule.dll";

    protected void Application_Start(object sender, EventArgs e)
    {

        var reg = new RegistrationBuilder();

        string path = HostingEnvironment.MapPath("~/bin");

        AggregateCatalog mAggrCatalog = new AggregateCatalog();

        mAggrCatalog.Catalogs.Add(new DirectoryCatalog(path, TaskServices, reg));


        reg.ForTypesMatching(t => IsDescendentOf(t, typeof(IRequestHandler<,>)))
                    .Export(builder => builder.AsContractType(typeof(IRequestHandler<,>)));


        //context.ForTypesMatching(t => t.GetInterface(typeof(IRequestHandler<,>).Name) != null)
        //            .ExportInterfaces());


        var container = new CompositionContainer(mAggrCatalog, CompositionOptions.DisableSilentRejection);

        container.ComposeExportedValue(mAggrCatalog);
    }

    private static bool IsGenericDescendentOf(TypeInfo openType, TypeInfo baseType)
    {
        if (openType.BaseType == null)
        {
            return false;
        }
        if (openType.BaseType == baseType.AsType())
        {
            return true;
        }
        foreach (Type type in openType.ImplementedInterfaces)
        {
            if (type.IsConstructedGenericType && (type.GetGenericTypeDefinition() == baseType.AsType()))
            {
                return true;
            }
        }
        return IsGenericDescendentOf(IntrospectionExtensions.GetTypeInfo(openType.BaseType), baseType);
    }

    private static bool IsDescendentOf(Type type, Type baseType)
    {
        if (((type == baseType) || (type == typeof(object))) || (type == null))
        {
            return false;
        }
        TypeInfo typeInfo = IntrospectionExtensions.GetTypeInfo(type);
        TypeInfo info2 = IntrospectionExtensions.GetTypeInfo(baseType);
        if (typeInfo.IsGenericTypeDefinition)
        {
            return IsGenericDescendentOf(typeInfo, info2);
        }
        return info2.IsAssignableFrom(typeInfo);
    }
   }
  }

The classes I'm exporting are on the HandlerModule class library project. Code below

namespace HandlerModule
{
public interface IRequestHandler<TRequest, TResponse>
{
    TResponse Handle(TRequest request);
}
}


namespace HandlerModule
{
public class GetOrderRequestHandler<TRequest, TResponse> : IRequestHandler<TRequest, TResponse>
    where TRequest: class
    where TResponse: class
{

    public GetOrderRequestHandler()
    {
    }

    public TResponse Handle(TRequest pRequest)
    {
            return "MyREsponse" as TResponse;
    }
}
}


New Post: The component (unknown) cannot be created outside the HttpContext sharing boundary.

$
0
0
Hi,
Because my application is getting bigger and more developers we run into this issue more and it hard to debug by hand.
Any chance someone at Microsoft can explain why we have unknown instead of Type name or something like that?

Thank you,
Ido.

New Post: Interfaces are resolved only once with MEF

$
0
0
We have set a Bootstrapper of Caliburn.Micro as below:
public class Bootstrapper : Bootstrapper<ShellViewModel> {
    private CompositionContainer container;

    protected override void Configure() {
        if (Execute.InDesignMode)
            return;

        IEnumerable<AssemblyCatalog> assemblyCatalogs = AssemblySource.Instance.Select(x => new AssemblyCatalog(x));
        AggregateCatalog aggregateCatalog = new AggregateCatalog(Enumerable.OfType<ComposablePartCatalog>(assemblyCatalogs));
        container = new CompositionContainer(aggregateCatalog);

        CompositionBatch batch = new CompositionBatch();

        batch.AddExportedValue<IWindowManager>(new WindowManager());
        batch.AddExportedValue<IEventAggregator>(new EventAggregator());
        batch.AddExportedValue(container);

        container.Compose(batch);            
    }
}

Here is ShellViewModel
[Export(typeof(ShellViewModel))]
public class ShellViewModel : Conductor<object>, IHandle<ChangePageMessage>, IHandle<OpenWindowMessage> {

[Import]
public IEventAggregator EventAggregator { get; private set; }

[Import]
public IWindowManager WindowManager { get; private set; }

public void Handle(ChangePageMessage message) {
  ActivateItem(message.ViewModel);
}

public void Handle(OpenWindowMessage message) {
  WindowManager.ShowWindow(message.ViewModel);
}

protected override void OnViewLoaded(object view) {
  EventAggregator.Subscribe(this);
  var vm = new DestinationChoiceViewModel();
  ActivateItem(vm);
}
}

IWindowManager and IEventAggregator are resolved in ShellViewModel.

But when DestinationChoiceViewModel loaded it's IWindowManager and IEventAggregator fields are null.

Here is a sample of DestinationChoiceViewModel:
[Export(typeof (DestinationChoiceViewModel))]
public class DestinationChoiceViewModel : Screen {
    private readonly DestinationChoiceModel model;

    [Import]
    public IEventAggregator EventAggregator { get; private set; }

    [Import]
    public IWindowManager WindowManager { get; private set; }

    public DestinationChoiceViewModel() {                     
        model = new DestinationChoiceModel();         
    }
So why are they resolved only in the first ViewModel? And how to force them to be resolved in other ViewModels?

New Post: Loading DLR dynamic instance or IronLanguage Type into MEF Catalog

$
0
0
Looking for a way to build up a catalog of IronPython or IronRuby Types. As the moment im using IronPythonMef but that only supports adding the exported ironpython types by directly composing those instances into the container, where as what Im looking for is a way to write some kind of custom directory catalog for other .net language types that can run on the DLR, so I was thinking i could get the Types involved in a python script file that need exporting...and then add these types somehow to a DLRTypeCatalog but not sure if this is doable.

any suggestions?

New Post: Why does RegistrationBuilder exclude parts decorated with a metadata attribute?

$
0
0
As of introduction: I know that Export and ExportMetadata attributes must be both specified on a part, so that the metadata can be accessed. It's related to the issue of InheritedExport, where metadata couldn't be specified on a deriving class. I also I recall it was by design.

As I researched how to overcome this limitation by using convention-based model, the behaviour I observed appears inconsistent. Let me continue explaining here not to distract the reader, but please refer to the code sample at the end of this post.

In the code there's a convention, which says "export all parts implementing IExtension" (how it adds metadata is a temporary thing).

If there are any exceptions to the convention, it can be handled by decorating the part with attributes as it's done with the Ext2 class in the example. Then, that specific part is exported "directly" without being processed by the convention. Having both Export and ExportMetadata attributes on Ext2 means: "override the convention when dealing with part Ext2".

If Ext1 is not marked with any attributes it is processed by the RegistrationBuilder and giving me chance to handle it as desired. Until now the behavior is expected.

But now, uncomment the ExportMetadata attribute decorating Ext1. As mentioned at the beginning a part would need both Export and ExportMetadata attributes to be considered a complete composition part (as it's done with Ext2). That's fine yet.

What's unexpected here is that Ext1 is no more passed to the convention builder. It's neither exported directly or allowed to work with in the registration rule. It's simply inaccessible/undiscoverable.

It can be narrowed down to cases when you use only ExportMetadata or any other custom metadata attribute without the Export attribute itself. Remember that if Ext1 is decorated with any attribute that is not a MetadataAttribute, then Ext1 is accessible from registration builder.

I understand the reasoning behind the necessity of applying both Export/ExportMetadata. However, if the Export attribute is missing and a part is rejected as incomplete, I believe it should be passed to the registration builder as it is "a part not handled directly via attributes". Now, if and only if one decorates a part with a metadata attribute, it is rejected by the system, as if it didn't exist. It's handled neither by the attributed nor the attribute-free mechanisms in MEF. Notice that it is rejected even though the metadata is not requested anywhere explicitly (like it would be when lazily loading parts).

To my current understanding there's no reason, why such behavior would be desired. I hope someone from the team could take a closer look at the code below and share the opinion whether or not it's an issue to fix.
    class Program
    {
        static void Main(string[] args)
        {
            var conventions = new RegistrationBuilder();
            conventions.ForTypesDerivedFrom<IExtension>()
                .Export<IExtension>(b =>
                {
                    b.AddMetadata("meta", t => t); //this would be sth based on 't'
                });

            var conventionCatalog = new AssemblyCatalog(typeof(Program).Assembly, conventions);
            var container = new CompositionContainer(conventionCatalog);

            var shell = new Shell();
            container.ComposeParts(shell);
        }
    }

    class Shell
    {
        [ImportMany]
        public IEnumerable<IExtension> Extensions { get; set; }
    }

    interface IExtension
    {
    }

    //[ExportMetadata("meta", "overridden")]
    class Ext1 : IExtension { }

    [Export(typeof(IExtension)), ExportMetadata("meta", "fully attributed")]
    class Ext2 : IExtension { }

New Post: Cannot access a disposed Object in Prism Mef

$
0
0
Hi ,

When I am trying to load the view from the container, it throwing the exception like below, but it was not reproducible again.

Can any one pls help me regarding this issue ?






Timestamp: 2/4/2014 12:13:50 PM
      Message: HandlingInstanceID: c39d0171-4f5f-40ab-9c24-a1bb5732eb7d

An exception of type 'System.ComponentModel.Composition.CompositionException' occurred and was caught.

02/04/2014 04:13:50
Type : System.ComponentModel.Composition.CompositionException, System.ComponentModel.Composition, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

1) Cannot access a disposed object.
Object name: 'System.ComponentModel.Composition.Hosting.CompositionContainer'.

Resulting in: Activation error occured while trying to get instance of type DelayedRegionCreationBehavior, key ""

Resulting in: Set property 'Microsoft.Practices.Prism.Regions.RegionManager.RegionName' threw an exception.

Resulting in: An exception occurred while trying to create an instance of type 'VCA.Sparky.Modules.EMR.Views.ExamFindingsView'.

Resulting in: Cannot activate part 'VCA.Sparky.Modules.EMR.Views.ExamFindingsView'.
Element: VCA.Sparky.Modules.EMR.Views.ExamFindingsView --> VCA.Sparky.Modules.EMR.Views.ExamFindingsView --> AssemblyCatalog (Assembly="VCA.Sparky.Modules.EMR, Version=2.27.14034.13, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'VCA.Sparky.Modules.EMR.Views.ExamFindingsView (ContractName="VCA.Sparky.Modules.EMR.Views.IExamFindingsView")' from part 'VCA.Sparky.Modules.EMR.Views.ExamFindingsView'.
Element: VCA.Sparky.Modules.EMR.Views.ExamFindingsView (ContractName="VCA.Sparky.Modules.EMR.Views.IExamFindingsView") --> VCA.Sparky.Modules.EMR.Views.ExamFindingsView --> AssemblyCatalog (Assembly="VCA.Sparky.Modules.EMR, Version=2.27.14034.13, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot set import 'VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel..ctor (Parameter="view", ContractName="VCA.Sparky.Modules.EMR.Views.IExamFindingsView")' on part 'VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel'.
Element: VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel..ctor (Parameter="view", ContractName="VCA.Sparky.Modules.EMR.Views.IExamFindingsView") --> VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel --> AssemblyCatalog (Assembly="VCA.Sparky.Modules.EMR, Version=2.27.14034.13, Culture=neutral, PublicKeyToken=null")

Resulting in: Cannot get export 'VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel (ContractName="VCA.Sparky.Modules.EMR.ViewModels.IExamFindingsViewModel")' from part 'VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel'.
Element: VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel (ContractName="VCA.Sparky.Modules.EMR.ViewModels.IExamFindingsViewModel") --> VCA.Sparky.Modules.EMR.ViewModels.ExamFindingsViewModel --> AssemblyCatalog (Assembly="VCA.Sparky.Modules.EMR, Version=2.27.14034.13, Culture=neutral, PublicKeyToken=null")

Source : System.ComponentModel.Composition
Help link :
Errors : System.Collections.ObjectModel.ReadOnlyCollection1[System.ComponentModel.Composition.CompositionError]
Data : System.Collections.ListDictionaryInternal
TargetSite : System.Object GetExportedValueFromComposedPart(System.ComponentModel.Composition.Hosting.ImportEngine, System.ComponentModel.Composition.Primitives.ComposablePart, System.ComponentModel.Composition.Primitives.ExportDefinition)
Stack Trace : at System.ComponentModel.Composition.Hosting.CompositionServices.GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.CatalogExport.GetExportedValueCore()
at System.ComponentModel.Composition.ExportServices.GetExportedValueFromLazy[T](Export export)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportedValueCore[T](String contractName, ImportCardinality cardinality)
at VCA.Sparky.Modules.EMR.Controller.EMRController.ExamFindingsLoadEventHandler(MedicalNoteArgs args) in c:\Builds\7\Spike\Woofware\Sources\Woofware\VCA.Sparky\Modules\VCA.Sparky.Modules.EMR\Controller\EMRController.cs:line 193
at Microsoft.Practices.Prism.Events.EventSubscription
1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments)
at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments)
at VCA.Sparky.Modules.Client.Controller.ClientController.LoadExamFindings(Patient pet) in c:\Builds\7\Spike\Woofware\Sources\Woofware\VCA.Sparky\Modules\VCA.Sparky.Modules.Client\Controller\ClientController.cs:line 5553
at VCA.Sparky.Modules.Client.ViewModels.ClientPanelViewModel.PetMenuSelectionChangedCommandHandler(PatientMenuItem item) in c:\Builds\7\Spike\Woofware\Sources\Woofware\VCA.Sparky\Modules\VCA.Sparky.Modules.Client\ViewModels\ClientPanelViewModel.cs:line 1162
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)




Thanks and regards,
Sivalingam

New Post: Resolver assembly file plug-ins in System.Composition (a la DirectoryCatalog)

$
0
0
(I'll refer to System.ComponentModel.Composition as .net 4.5 MEF and System.Composition as Windows Store Apps MEF)

I am using System.Composition with Web Api.

Besides the referenced types in the host project I want to discover some contract enforcing plug-ins in a folder.

How can I accomplish it with System.Composition?

Do I need to bridge it with System.ComponentModel.Composition? And If so will it hurt my performance?

I have used System.Composition since it seems a lightweight version for Windows Store and Web Apps. Should I just stick with System.ComponentModel.Composition?

Thanks.

New Post: Resolver assembly file plug-ins in System.Composition (a la DirectoryCatalog)

$
0
0
Would loading the assembly from file system when bootstrapping, thus feeding it to the ContainerConfiguration.WithAssembly(...) be an acceptable solution? Is there a more elegant solution using MEF's facilities?

New Post: Tracing on System.Composition

$
0
0
Doesn't System.Composition have an implemented TraceSource so that Trace Listeners can be attached via configuration?

What is the recommended approach for Instrumentation and Tracing?

Thanks

New Post: When is a composed NonShared object released for garbage collection

$
0
0
I wanted to know what is the lifetime of a composed NonShared object?
For example if I created an object(which is a ViewModel) using an ExportFactory<object,Metadata> (the Metadata being used to resolve what kind of VM needs to be created) and the only reference to the ViewModel is the DataContext of the View. What should happen to the ViewModel when the View is destroyed?

In my particular case the ViewModel stays in memory until the application is terminated.

p.s : I see that the ViewModel is held in a Hashset<IDisposables> by the CatalogExportProvider
Viewing all 265 articles
Browse latest View live