/// <summary>
        /// This method initializes the session with constructor.
        /// </summary>
        public CSharpSession(
            Guid sessionId,
            ushort taskId,
            ushort numTasks,
            string script,
            ushort inputSchemaColumnsNumber,
            ushort parametersNumber,
            string inputDataName,
            string outputDataName,
            CSharpUserDll userDll)
        {
            Logging.Trace("CSharpSession::CSharpSession");
            _sessionId = sessionId;
            _taskId    = taskId;
            _numTasks  = numTasks;
            _script    = script;
            _inputSchemaColumnsNumber = inputSchemaColumnsNumber;
            _parametersNumber         = parametersNumber;
            _inputDataName            = inputDataName;
            _outputDataName           = outputDataName;
            _userDll      = userDll;
            _inputDataSet = new CSharpInputDataSet
            {
                Name          = inputDataName,
                ColumnsNumber = inputSchemaColumnsNumber
            };

            _outputDataSet = new CSharpOutputDataSet
            {
                Name          = outputDataName,
                ColumnsNumber = 0
            };

            _paramContainer = new CSharpParamContainer(parametersNumber);
        }
        /// <summary>
        /// This method implements InitSession API
        /// </summary>
        /// <param name="sessionId">
        /// GUID uniquely identifying this script session.
        /// </param>
        /// <param name="taskId">
        /// An integer uniquely identifying this execution process.
        /// </param>
        /// <param name="numTasks">
        /// Number of tasks for this session.
        /// </param>
        /// <param name="script">
        /// Null-terminated UTF-8 string containing the @script in sp_execute_external_script.
        /// </param>
        /// <param name="scriptLength">
        /// Length in bytes of ScriptScript (excluding the null termination character).
        /// </param>
        /// <param name="inputSchemaColumnsNumber">
        /// Number of columns in the result set from @input_data_1 in sp_execute_external_script.
        /// </param>
        /// <param name="parametersNumber">
        /// Number of input parameters from @params in sp_execute_external_script.
        /// </param>
        /// <param name="inputDataName">
        /// Null-terminated UTF-8 string containing the @input_data_1_name in sp_execute_external_script.
        /// </param>
        /// <param name="inputDataNameLength">
        /// Length in bytes of InputDataName (excluding the null termination character).
        /// </param>
        /// <param name="outputDataName">
        /// Null-terminated UTF-8 string containing the @output_data_1_name in sp_execute_external_script.
        /// </param>
        /// <param name="outputDataNameLength">
        /// Length in bytes of OutputDataName (excluding the null termination character).
        /// </param>
        /// <returns>
        /// SQL_SUCCESS(0), SQL_ERROR(-1)
        /// </returns>
        public static short InitSession(
            Guid sessionId,
            ushort taskId,
            ushort numTasks,
            char *script,
            ulong scriptLength,
            ushort inputSchemaColumnsNumber,
            ushort parametersNumber,
            char *inputDataName,
            ushort inputDataNameLength,
            char *outputDataName,
            ushort outputDataNameLength)
        {
            Logging.Trace("CSharpExtension::InitSession");
            return(ExceptionUtils.WrapError(() =>
            {
                string scriptStr = (script != null) ? Interop.UTF8PtrToStr(script, scriptLength) : string.Empty;
                string inputDataNameStr = Interop.UTF8PtrToStr(inputDataName, inputDataNameLength);
                string outputDataNameStr = Interop.UTF8PtrToStr(outputDataName, outputDataNameLength);
                CSharpUserDll userDll = new CSharpUserDll(
                    publicPath: _publicLibraryPath,
                    privatePath: _privateLibraryPath,
                    userScriptFullName: scriptStr);

                _currentSession = new CSharpSession(
                    sessionId: sessionId,
                    taskId: taskId,
                    numTasks: numTasks,
                    script: scriptStr,
                    inputSchemaColumnsNumber: inputSchemaColumnsNumber,
                    parametersNumber: parametersNumber,
                    inputDataName: inputDataNameStr,
                    outputDataName: outputDataNameStr,
                    userDll: userDll);
            }));
        }