private void InitParameters(Parse headerCells)
        {
            Dictionary <String, DbParameterAccessor> allParams =
                dbEnvironment.GetAllProcedureParameters(procedureName);

            columnAccessors = new ColumnAccessors();
            for (int i = 0; headerCells != null; i++, headerCells = headerCells.More)
            {
                String paramName = NameNormaliser.NormaliseName(headerCells.Text);
                try
                {
                    DbParameterAccessor accessor = DbParameterAccessor.CloneWithSameParameter(allParams[paramName]);
                    accessor.IsBoundToCheckOperation = BindingFactory.CheckIsImpliedBy(headerCells.Text);
                    // sql server quirk. if output parameter is used in an input column, then
                    // the param should be remapped to IN/OUT
                    if ((!accessor.IsBoundToCheckOperation) &&
                        accessor.DbParameter.Direction == ParameterDirection.Output)
                    {
                        accessor.DbParameter.Direction = ParameterDirection.InputOutput;
                    }
                    columnAccessors.Assign(paramName, accessor);
                    accessors.Add(accessor);
                }
                catch (KeyNotFoundException)
                {
                    Wrong(headerCells);
                    throw new ApplicationException("Cannot find parameter " + paramName);
                }
            }
        }
Пример #2
0
        private void InitParameters(Parse headerCells)
        {
            Dictionary <String, DbParameterAccessor> allParams =
                dbEnvironment.GetAllProcedureParameters(procedureName);

            accessors = new DbParameterAccessor[headerCells.Size];
            for (int i = 0; headerCells != null; i++, headerCells = headerCells.More)
            {
                String paramName = NameNormaliser.NormaliseName(headerCells.Text);
                try
                {
                    accessors[i] = DbParameterAccessor.CloneWithSameParameter(allParams[paramName]);
                }
                catch (System.Collections.Generic.KeyNotFoundException)
                {
                    Wrong(headerCells);
                    throw new ApplicationException("Cannot find parameter " + paramName);
                }
                accessors[i].IsBoundToCheckOperation = checkIsImpliedByRegex.IsMatch(headerCells.Text);
                // sql server quirk. if output parameter is used in an input column, then
                // the param should be remapped to IN/OUT
                if ((!accessors[i].IsBoundToCheckOperation) &&
                    accessors[i].DbParameter.Direction == ParameterDirection.Output)
                {
                    accessors[i].DbParameter.Direction = ParameterDirection.InputOutput;
                }
            }
        }