/
IntegerConverters.cs
61 lines (49 loc) · 1.56 KB
/
IntegerConverters.cs
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
using System;
using System.Data;
namespace ServiceStack.OrmLite.Converters
{
public abstract class IntegerConverter : NativeValueOrmLiteConverter
{
public override string ColumnDefinition => "INTEGER";
public override DbType DbType => DbType.Int32;
public override object ToDbValue(Type fieldType, object value)
{
return this.ConvertNumber(fieldType, value);
}
public override object FromDbValue(Type fieldType, object value)
{
return this.ConvertNumber(fieldType, value);
}
}
public class ByteConverter : IntegerConverter
{
public override DbType DbType => DbType.Byte;
}
public class SByteConverter : IntegerConverter
{
public override DbType DbType => DbType.SByte;
}
public class Int16Converter : IntegerConverter
{
public override DbType DbType => DbType.Int16;
}
public class UInt16Converter : IntegerConverter
{
public override DbType DbType => DbType.UInt16;
}
public class Int32Converter : IntegerConverter {}
public class UInt32Converter : IntegerConverter
{
public override DbType DbType => DbType.UInt32;
}
public class Int64Converter : IntegerConverter
{
public override DbType DbType => DbType.Int64;
public override string ColumnDefinition => "BIGINT";
}
public class UInt64Converter : IntegerConverter
{
public override DbType DbType => DbType.UInt64;
public override string ColumnDefinition => "BIGINT";
}
}