IdeaBlade.Core Assembly > IdeaBlade.Core.Composition Namespace : ICompositionContextResolver Interface |
'Declaration
<InterfaceExportAttribute(ContractName="", ContractType=IdeaBlade.Core.Composition.ICompositionContextResolver)> Public Interface ICompositionContextResolver
'Usage
Dim instance As ICompositionContextResolver
[InterfaceExport(ContractName="", ContractType=IdeaBlade.Core.Composition.ICompositionContextResolver)] public interface ICompositionContextResolver
// Sample ICompositionContextResolver used when using one or more custom contexts. public class CompositionContextResolver : ICompositionContextResolver { public static CompositionContext myMock = new CompositionContext("MyMock", true, typeof(MockEntityServerSaveInterceptor), typeof(MockEntityServerQueryInterceptor)); public CompositionContext GetCompositionContext(string compositionContextName) { if (compositionContextName == myMock.Name) { return myMock; } else { return null; } } } // Sample class - note it is marked as not discoverable so that standard MEF // composition will not find it. [PartNotDiscoverable] public class MockEntityServerQueryInterceptor : EntityServerQueryInterceptor { protected override bool ExecuteQuery() { throw new InvalidOperationException(); } } [PartNotDiscoverable] public class MockEntityServerSaveInterceptor : EntityServerSaveInterceptor { protected override bool ExecuteSave() { throw new InvalidOperationException(); } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2