Represents a Hypertable context factory.

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 IContextFactory
Public Interface IContextFactory
public interface class IContextFactory

Members

      
 All Members  Methods  
 Public

 Protected
 Instance

 Static 
 Declared

 Inherited
 XNA Framework Only 

 .NET Compact Framework Only 

 MemberDescription
Create(IDictionary<(Of <<'(String, Object>)>>))
Creates a new Context instance using specified configuration properties.
Create(String)
Creates a new Context instance using specified connection string.
Create(String, IDictionary<(Of <<'(String, Object>)>>))
Creates a new Context instance using specified configuration properties.

Examples

The following example shows how to import the context factory.
CopyC#
using System;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Reflection;

class ImportContextFactory
{
   [Import(typeof(IContextFactory))]
   private IContextFactory contextFactory;

   public Compose()
      using (var catalog = new AggregateCatalog()) {
         catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetAssembly(typeof(IContextFactory))));
         using (var container = new CompositionContainer(catalog)) {
            container.ComposeParts(this);

            using (var context = this.contextFactory.Create("Provider=Hyper; Uri=net.tcp://localhost")) {
               using (var client = context.CreateClient()) {
                  // use the client
               }
            }
         }
      }
   }
}

See Also