本文整理汇总了C#中System.Data.SqlClient.ManualTesting.Tests.SqlRandomTableColumn类的典型用法代码示例。如果您正苦于以下问题:C# SqlRandomTableColumn类的具体用法?C# SqlRandomTableColumn怎么用?C# SqlRandomTableColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlRandomTableColumn类属于System.Data.SqlClient.ManualTesting.Tests命名空间,在下文中一共展示了SqlRandomTableColumn类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlRandomTable
public SqlRandomTable(SqlRandomTableColumn[] columns, int? primaryKeyColumnIndex = null, int estimatedRowCount = 0)
{
if (columns == null || columns.Length == 0)
throw new ArgumentException("non-empty type array is required");
if (estimatedRowCount < 0)
throw new ArgumentOutOfRangeException("non-negative row count is required, use 0 for default");
if (primaryKeyColumnIndex.HasValue && (primaryKeyColumnIndex.Value < 0 || primaryKeyColumnIndex.Value >= columns.Length))
throw new ArgumentOutOfRangeException("primaryColumnIndex");
PrimaryKeyColumnIndex = primaryKeyColumnIndex;
_columns = (SqlRandomTableColumn[])columns.Clone();
_columnNames = new string[columns.Length];
if (estimatedRowCount == 0)
_rows = new List<object[]>();
else
_rows = new List<object[]>(estimatedRowCount);
Columns = new List<SqlRandomTableColumn>(_columns).AsReadOnly();
ColumnNames = new List<string>(_columnNames).AsReadOnly();
bool hasSparse = false;
double totalNonSparse = 0;
foreach (var c in _columns)
{
if (c.IsSparse)
{
hasSparse = true;
}
else
{
totalNonSparse += c.GetInRowSize(null); // for non-sparse columns size does not depend on the value
}
}
HasSparseColumns = hasSparse;
NonSparseValuesTotalSize = totalNonSparse;
}
示例2: GetTSqlTypeDefinitionInternal
protected override string GetTSqlTypeDefinitionInternal(SqlRandomTableColumn columnInfo)
{
string sizeSuffix;
if (!columnInfo.StorageSize.HasValue)
{
sizeSuffix = DefaultSize.ToString();
}
else
{
int size = columnInfo.StorageSize.Value;
if (size > MaxDefinedSize)
{
sizeSuffix = "max";
}
else
{
Debug.Assert(size > 0, "wrong size");
sizeSuffix = size.ToString();
}
}
return string.Format("{0}({1})", TypePrefix, sizeSuffix);
}
示例3: CompareValuesInternal
protected override bool CompareValuesInternal(SqlRandomTableColumn columnInfo, object expected, object actual)
{
if ((columnInfo.Options & SqlRandomColumnOptions.ColumnSet) != 0)
{
throw new InvalidOperationException("should not be used for ColumnSet columns - use CanCompareValues before calling this method");
}
return CompareCharArray(expected, actual, allowIncomplete: false);
}
示例4: ReadInternal
protected override object ReadInternal(DbDataReader reader, int ordinal, SqlRandomTableColumn columnInfo, Type asType)
{
return ReadByteArray(reader, ordinal, asType);
}
示例5: GetInRowSizeInternal
protected override double GetInRowSizeInternal(SqlRandomTableColumn columnInfo)
{
return GetCharSize(columnInfo) * 2; // nchar is not stored in row
}
示例6: GetCharSize
private int GetCharSize(SqlRandomTableColumn columnInfo)
{
ValidateColumnInfo(columnInfo);
int charSize = columnInfo.StorageSize.HasValue ? columnInfo.StorageSize.Value / 2 : DefaultCharSize;
if (charSize < 1 || charSize > MaxCharSize)
throw new NotSupportedException("wrong size");
return charSize;
}
示例7: CreateRandomValueInternal
protected override object CreateRandomValueInternal(SqlRandomizer rand, SqlRandomTableColumn columnInfo)
{
int size = columnInfo.StorageSize.HasValue ? columnInfo.StorageSize.Value : DefaultCharSize;
return rand.NextAnsiArray(0, size);
}
示例8: CanCompareValues
public override bool CanCompareValues(SqlRandomTableColumn columnInfo)
{
// completely ignore TIMESTAMP value comparison
return false;
}