Represents a Hypertable context provider.

Namespace: Hypertable.Composition
Assembly: ht4n (in ht4n.dll) Version: 0.9.8.11 (0.9.8.11)

Syntax

         
 C#  Visual Basic  Visual C++ 
public interface IContextProvider
Public Interface IContextProvider
public interface class IContextProvider

Members

      
 All Members  Properties  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
Provider
Gets the context provider.

Examples

The following example shows how to export a context provider.
CopyC#
using System;
using System.Collections.Generic;
using Hypertable.Composition;

[ExportContextProvider("SampleContextProvider")]
public class SampleContextProvider : IContextProvider
{
    public Func<IDictionary<string, object>, IContext> Provider {
        get {
            return (properties) => new SampleContext(properties);
        }
    }
}

void foo() {
   // set the "Ht4n.Composition.ComposablePartCatalogs" property which expects
   // a ComposablePartCatalog or an IEnumerable<ComposablePartCatalog>
   var properties = new Dictionary<string, object>
      {
         { "Ht4n.Composition.ComposablePartCatalogs", new AssemblyCatalog(GetAssembly(this.GetType())) }
      };
   using (var context = Context.Create("Provider=TestContextProvider", properties)) {
      // use the context
   }
}

See Also