| Visual Basic (Declaration) | |
|---|---|
Public Overloads Function WithGenerator( _ ByVal type As Type _ ) As CompositionContext | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As CompositionContext Dim type As Type Dim value As CompositionContext value = instance.WithGenerator(type) | |
| C# | |
|---|---|
public CompositionContext WithGenerator( Type type ) | |
| C++/CLI | |
|---|---|
public: CompositionContext^ WithGenerator( Type^ type ) | |
Parameters
- type
| Exception | Description |
|---|---|
| System.ArgumentException | Thrown if the type does not have a composable base type or interface |
| C# | Copy Code |
|---|---|
public class CompositionContextResolver : BaseCompositionContextResolver { // Creates a new context from the Default context, indicating that the // specified type should be used whenever an export // matching its interface/base class is requested. CompositionContext Mock = CompositionContext.Default .WithGenerator(typeof(MockEntityServerQueryInterceptor)) .WithName("Mock"); } [PartNotDiscoverable] public class MockEntityServerQueryInterceptor : EntityServerQueryInterceptor { protected override bool ExecuteQuery() { throw new InvalidOperationException(); } } | |
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family