Database Reference
In-Depth Information
Once you have the source, make sure you also have the .NET framework, version 3.5 or better,
which you can download for free from Microsoft.com. You can also use the Visual Studio .NET
2010 Express IDE, which is free, uses the .NET 4.0 framework, and makes it very easy to work
with C# projects. Download Visual Studio C# Express from http://www.microsoft.com/express/
Downloads . This may take a while and will require you to restart your computer.
Once Visual Studio is installed, open the HectorSharp project so you can view the source code
and add it as a reference to our own project. To open the project, choose File > Open Project...
and then select the file HectorSharp.sln. The Express version of Visual Studio may complain
about not doing Solution files, but don't worry about that.
Build the HectorSharp source by right-clicking the HectorSharp project name in the Solution
Explorer window. You should see a notice in the bottom-left corner saying “Build Succeeded”.
This will produce the HectorSharp .dllclient that we can use in our own application.
To create our application that wraps HectorSharp, choose File > New Project... > Console Ap-
plication. Call your new project ExecuteHector. You'll be presented with a shell class called Pro-
gram.cswith a main method.
Now let's reference the HectorSharp DLL so we can use its classes. To do this, choose Project
> Add Reference. When the dialog window comes up, pick the Browse tab, then navigate to the
location where you unpacked HectorSharp. Go to the bin\Releasedirectory and pick the Hector-
Sharp.dllile. You should see HectorSharp added as a reference in your Solution Explorer.
NOTE
I have changed the name of my application to CassandraProgram.cs. If you do this too, you'll need to
change the executable in the project by choosing Project > ExecuteHector Properties. Choose the Ap-
plication tab, and then enter your program name in the Startup Object field.
Let's take a quick look at some of the high-level constructs that HectorSharp makes available:
ICassandraClient
ICassandraClient
This is the interface used by HectorSharp client objects, whose implementation type is typ-
ically a KeyedCassandraClientFactory object.
Pool
Pool
HectorSharp pools its connections to Cassandra, so you use a factory method to create a
pool, like this: Pool = new CassandraClientPoolFactory().Create() ;. Then, using
the pool, you can create a client.
Search WWH ::




Custom Search