public
Created

SqlCeParameter.Size implementation

  • Download Gist
gistfile1.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
public override int Size
{
get
{
return this.size;
}
set
{
if (this.size == value)
return;
this.BindingChange();
if (value < 0)
{
throw new ArgumentOutOfRangeException(System.Data.SqlServerCe.Res.GetString("ADP_InvalidSizeValue", new object[1]
{
(object) value.ToString((IFormatProvider) CultureInfo.CurrentCulture)
}));
}
else
{
int val2 = int.MaxValue;
switch (this.typeMap.sqlDbType)
{
case SqlDbType.BigInt:
val2 = SqlCeType._BigInt.fixlen;
break;
case SqlDbType.Binary:
val2 = SqlCeType.MAX_BINARY_COLUMN_SIZE;
break;
case SqlDbType.Bit:
val2 = SqlCeType._Bit.fixlen;
break;
case SqlDbType.DateTime:
val2 = SqlCeType._DateTime.fixlen;
break;
case SqlDbType.Decimal:
val2 = SqlCeType._Numeric.fixlen;
break;
case SqlDbType.Float:
val2 = SqlCeType._Float.fixlen;
break;
case SqlDbType.Image:
val2 = SqlCeType.MAX_IMAGE_COLUMN_SIZE;
break;
case SqlDbType.Int:
val2 = SqlCeType._Int.fixlen;
break;
case SqlDbType.Money:
val2 = SqlCeType._Money.fixlen;
break;
case SqlDbType.NChar:
val2 = SqlCeType.MAX_NCHAR_COLUMN_SIZE;
break;
case SqlDbType.NText:
val2 = SqlCeType.MAX_NTEXT_COLUMN_SIZE;
break;
case SqlDbType.NVarChar:
val2 = SqlCeType.MAX_NCHAR_COLUMN_SIZE;
break;
case SqlDbType.Real:
val2 = SqlCeType._Real.fixlen;
break;
case SqlDbType.UniqueIdentifier:
val2 = SqlCeType._UniqueIdentifier.fixlen;
break;
case SqlDbType.SmallInt:
val2 = SqlCeType._SmallInt.fixlen;
break;
case SqlDbType.Timestamp:
val2 = SqlCeType._RowVersion.fixlen;
break;
case SqlDbType.TinyInt:
val2 = SqlCeType._TinyInt.fixlen;
break;
case SqlDbType.VarBinary:
val2 = SqlCeType.MAX_BINARY_COLUMN_SIZE;
break;
}
this.size = Math.Min(value, val2);
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.