Represents a Hypertable context factory.

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

Syntax

         
 C#  Visual Basic  Visual C++ 
public sealed class Context : IContext
Public NotInheritable Class Context _
	Implements IContext
public ref class Context sealed : IContext

Members

            
 All Members  Properties   Methods   Events  
 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.
CreateClient()()()()
Creates a new Client instance.
Dispose()()()()
Clean up all managed and unmanaged resources.
Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the Type of the current instance.
(Inherited from Object.)
HasFeature(ContextFeature)
Returns true if the actual provider supports the feature specified, otherwise false.
IsDisposed
Gets a value indicating whether the object has been disposed.
Properties
Gets the configuration properties.
RegisterProvider(String, Func<(Of <<'(IDictionary<(Of <<'(String, Object>)>>), IContext>)>>))
Registers a custom context provider.
SessionStateChanged
Occurs when the Hypertable session state changed.
ToString()()()()
Returns a string that represents the current object.
(Inherited from Object.)
UnregisterProvider(String)
Unregisters a custom context provider.

Remarks

Default initialization of the Hypertable context uses the configuration (conf/hypertable.cfg) of the executing process if exist.

Examples

The following example shows how to create a Hypertable context.
CopyC#
using( var ctx = Context.Create("Provider=Hyper; Uri=localhost") ) {
   using( var client = ctx.CreateClient() ) {
      // use client
   }
}
The following example shows how to create a Hypertable context using configuration properties.
CopyC#
IDictionary<string, object> properties = new Dictionary<string, object>();
properties.Add("Hypertable.Logging.Level", "info");
using( var ctx = Context.Create("Provider=Hyper; Uri=localhost", properties) ) {
   using( var client = ctx.CreateClient() ) {
      // use client
   }
}
The following example shows how to create a Hypertable context using an external configuration file.
CopyC#
using( var ctx = Context.Create("Provider=Hyper; Uri=localhost; config=TestConfiguration.cfg") ) {
   using( var client = ctx.CreateClient() ) {
      // use client
   }
}
The following example shows how to access the configuration properties.
CopyC#
using( var ctx = Context.Create("Provider=Thrift; Uri=localhost") ) {
   int thriftBrokerTimeout = (int)ctx.Properties["ThriftBroker.Timeout"];
}

Inheritance Hierarchy

System..::..Object
  Hypertable..::..Context

See Also