Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (50 sloc) 1.09 kb
using System;
namespace FluentCassandra.Connections
{
public abstract class ConnectionProvider : IConnectionProvider
{
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
protected ConnectionProvider(IConnectionBuilder builder)
{
ConnectionBuilder = builder;
Servers = new RoundRobinServerManager(builder);
}
/// <summary>
///
/// </summary>
public IConnectionBuilder ConnectionBuilder { get; private set; }
/// <summary>
///
/// </summary>
public IServerManager Servers { get; private set; }
/// <summary>
///
/// </summary>
/// <returns></returns>
public abstract IConnection CreateConnection();
/// <summary>
///
/// </summary>
/// <returns></returns>
public virtual IConnection Open()
{
var conn = CreateConnection();
conn.Open();
return conn;
}
/// <summary>
///
/// </summary>
/// <param name="connection"></param>
/// <returns></returns>
public virtual bool Close(IConnection connection)
{
if (connection.IsOpen)
connection.Close();
return true;
}
}
}
Jump to Line
Something went wrong with that request. Please try again.