DevForce Help Reference
BaseCompositionContextResolver Class
Members  Example 


Abstract ICompositionContextResolver that automatically registers any statically defined CompositionContexts found within the class.
Syntax
'Declaration
 
<PartNotDiscoverableAttribute()>
Public MustInherit Class BaseCompositionContextResolver 
   Implements ICompositionContextResolver 
'Usage
 
Dim instance As BaseCompositionContextResolver
[PartNotDiscoverable()]
public abstract class BaseCompositionContextResolver : ICompositionContextResolver  
Remarks
If you subclass the BaseCompositionContextResolver and provide static field definitions for your custom CompositionContexts, DevForce will automatically find and register these contexts as needed, and you will not need to implement the GetCompositionContext method. You can still use GetCompositionContext to dynamically construct a CompositionContext for the specified name, but there is no need to do so if all of your composition contexts can be defined statically.
Example
// Sample BaseCompositionContextResolver sub-type providing static fields defining CompositionContexts.
public class CompositionContextResolver : BaseCompositionContextResolver {
 
  public static CompositionContext Mock = new CompositionContext("MyMock", true,
    typeof(MockEntityServerSaveInterceptor), typeof(MockEntityServerQueryInterceptor));
}
 
// 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();
   }
}
Inheritance Hierarchy

System.Object
   IdeaBlade.Core.Composition.BaseCompositionContextResolver

Requirements

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

See Also

Reference

BaseCompositionContextResolver Members
IdeaBlade.Core.Composition Namespace

Send Feedback