43 lines
1.6 KiB
C#
43 lines
1.6 KiB
C#
#nullable enable
|
|
using System;
|
|
using System.Collections;
|
|
|
|
namespace BCG
|
|
{
|
|
/// <summary>
|
|
/// Represents a primitive immutable anologue of a dotNet DataRow. The user assumes no info about the row
|
|
/// but the number of columns, and the way to access data through the indexer by providing either the
|
|
/// ordinal or the name. Also note that the default iteration through the IBlueRow return DictionaryEntry
|
|
/// (ie the default iteration is the same as an IDictionary's iteration)
|
|
/// </summary>
|
|
public interface IBlueRow : IDictionary
|
|
{
|
|
/// <summary>
|
|
/// Gets the schema of the row, which is same as that of the IBlueRowCollections to which it belongs
|
|
/// </summary>
|
|
IBlueTableSchema schema{get;}
|
|
/// <summary>
|
|
/// Though the IDictionary supports an untyped indexer, having the typed indexer makes retreivals
|
|
/// faster, specially in the case of large tables, where one type checking per cell would amount to
|
|
/// a sizeable time, eg for a table with 20000 rows and a schema of 20 columns, we will save about
|
|
/// half a million type checkings
|
|
/// </summary>
|
|
object? this[int index] {get;}
|
|
object? this[string colName] {get;}
|
|
}
|
|
namespace Extensions
|
|
{
|
|
public static class IBlueRowExtensions
|
|
{
|
|
public static bool isDBNull(this object? val)
|
|
{
|
|
return (val == null || val == DBNull.Value);
|
|
}
|
|
public static bool isNotDBNull(this object? val)
|
|
{
|
|
return (val != null && val != DBNull.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|