protected IExternalBlobConnection GetExternalBlobConnection(ISessionImplementor session)
{
if (session.Connection == null) throw new NullReferenceException("CasBlobType requires an open connection.");
IExternalBlobConnection c = session.Connection as IExternalBlobConnection;
if (c == null) throw new Exception("ExternalBlobTypes requires a IExternalBlobConnection. Make sure you use NHibernate.Lob.External.DriverConnectionProvider and specify an IExternalBlobConnectionProvider in your NHibernate configuration.");
if (identifierLength == 0) identifierLength = c.BlobIdentifierLength;
return c;
}