Ejemplo n.º 1
0
        public void AddParameters(IDbCommand command, SqlMapper.Identity identity)
        {
            SqlCommand sqlCommand = null;

            if (typeof(SqlCommand).GetTypeInfo().IsInstanceOfType(command))
            {
                sqlCommand = command.As <SqlCommand>();
            }
            if (sqlCommand == null)
            {
                throw new ArgumentException("Could not convert to a SqlCommand.", $"{typeof(SqlCommand).Name}");
            }

            SqlParameter sqlParameter = sqlCommand.Parameters.Add(_parameterName, SqlDbType.Structured);

            sqlParameter.Direction = ParameterDirection.Input;
            sqlParameter.TypeName  = _typeName;
            sqlParameter.Value     = _rows;
        }