public void SetCursor(ICursor cursor)
{
if (cursor == null)
throw new ArgumentNullException("cursor");
if (HasResult)
throw new InvalidOperationException("The context has already a result set.");
if (HasCursor)
throw new InvalidOperationException("A cursor was already set as result of this context.");
Cursor = cursor;
HasCursor = true;
}