Mercurial > pub > bltoolkit
comparison Source/Mapping/MapDataSourceBase.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f990fcb411a9 |
---|---|
1 using System; | |
2 using System.Data.SqlTypes; | |
3 | |
4 namespace BLToolkit.Mapping | |
5 { | |
6 public abstract class MapDataSourceBase : IMapDataSource | |
7 { | |
8 #region IMapDataSource Members | |
9 | |
10 public abstract int Count { get; } | |
11 public abstract Type GetFieldType(int index); | |
12 public abstract string GetName (int index); | |
13 public abstract int GetOrdinal (string name); | |
14 public abstract object GetValue (object o, int index); | |
15 public abstract object GetValue (object o, string name); | |
16 | |
17 public virtual bool IsNull (object o, int index) { return GetValue(o, index) == null; } | |
18 | |
19 public virtual bool SupportsTypedValues(int index) { return true; } | |
20 | |
21 // Simple type getters. | |
22 // | |
23 [CLSCompliant(false)] | |
24 public virtual SByte GetSByte (object o, int index) { return Map.DefaultSchema.ConvertToSByte (GetValue(o, index)); } | |
25 public virtual Int16 GetInt16 (object o, int index) { return Map.DefaultSchema.ConvertToInt16 (GetValue(o, index)); } | |
26 public virtual Int32 GetInt32 (object o, int index) { return Map.DefaultSchema.ConvertToInt32 (GetValue(o, index)); } | |
27 public virtual Int64 GetInt64 (object o, int index) { return Map.DefaultSchema.ConvertToInt64 (GetValue(o, index)); } | |
28 | |
29 public virtual Byte GetByte (object o, int index) { return Map.DefaultSchema.ConvertToByte (GetValue(o, index)); } | |
30 [CLSCompliant(false)] | |
31 public virtual UInt16 GetUInt16 (object o, int index) { return Map.DefaultSchema.ConvertToUInt16 (GetValue(o, index)); } | |
32 [CLSCompliant(false)] | |
33 public virtual UInt32 GetUInt32 (object o, int index) { return Map.DefaultSchema.ConvertToUInt32 (GetValue(o, index)); } | |
34 [CLSCompliant(false)] | |
35 public virtual UInt64 GetUInt64 (object o, int index) { return Map.DefaultSchema.ConvertToUInt64 (GetValue(o, index)); } | |
36 | |
37 public virtual Boolean GetBoolean (object o, int index) { return Map.DefaultSchema.ConvertToBoolean (GetValue(o, index)); } | |
38 public virtual Char GetChar (object o, int index) { return Map.DefaultSchema.ConvertToChar (GetValue(o, index)); } | |
39 public virtual Single GetSingle (object o, int index) { return Map.DefaultSchema.ConvertToSingle (GetValue(o, index)); } | |
40 public virtual Double GetDouble (object o, int index) { return Map.DefaultSchema.ConvertToDouble (GetValue(o, index)); } | |
41 public virtual Decimal GetDecimal (object o, int index) { return Map.DefaultSchema.ConvertToDecimal (GetValue(o, index)); } | |
42 public virtual Guid GetGuid (object o, int index) { return Map.DefaultSchema.ConvertToGuid (GetValue(o, index)); } | |
43 public virtual DateTime GetDateTime (object o, int index) { return Map.DefaultSchema.ConvertToDateTime(GetValue(o, index)); } | |
44 public virtual DateTimeOffset GetDateTimeOffset(object o, int index) { return Map.DefaultSchema.ConvertToDateTimeOffset(GetValue(o, index)); } | |
45 | |
46 // Nullable type getters. | |
47 // | |
48 [CLSCompliant(false)] | |
49 public virtual SByte? GetNullableSByte (object o, int index) { return Map.DefaultSchema.ConvertToNullableSByte (GetValue(o, index)); } | |
50 public virtual Int16? GetNullableInt16 (object o, int index) { return Map.DefaultSchema.ConvertToNullableInt16 (GetValue(o, index)); } | |
51 public virtual Int32? GetNullableInt32 (object o, int index) { return Map.DefaultSchema.ConvertToNullableInt32 (GetValue(o, index)); } | |
52 public virtual Int64? GetNullableInt64 (object o, int index) { return Map.DefaultSchema.ConvertToNullableInt64 (GetValue(o, index)); } | |
53 | |
54 public virtual Byte? GetNullableByte (object o, int index) { return Map.DefaultSchema.ConvertToNullableByte (GetValue(o, index)); } | |
55 [CLSCompliant(false)] | |
56 public virtual UInt16? GetNullableUInt16 (object o, int index) { return Map.DefaultSchema.ConvertToNullableUInt16 (GetValue(o, index)); } | |
57 [CLSCompliant(false)] | |
58 public virtual UInt32? GetNullableUInt32 (object o, int index) { return Map.DefaultSchema.ConvertToNullableUInt32 (GetValue(o, index)); } | |
59 [CLSCompliant(false)] | |
60 public virtual UInt64? GetNullableUInt64 (object o, int index) { return Map.DefaultSchema.ConvertToNullableUInt64 (GetValue(o, index)); } | |
61 | |
62 public virtual Boolean? GetNullableBoolean (object o, int index) { return Map.DefaultSchema.ConvertToNullableBoolean (GetValue(o, index)); } | |
63 public virtual Char? GetNullableChar (object o, int index) { return Map.DefaultSchema.ConvertToNullableChar (GetValue(o, index)); } | |
64 public virtual Single? GetNullableSingle (object o, int index) { return Map.DefaultSchema.ConvertToNullableSingle (GetValue(o, index)); } | |
65 public virtual Double? GetNullableDouble (object o, int index) { return Map.DefaultSchema.ConvertToNullableDouble (GetValue(o, index)); } | |
66 public virtual Decimal? GetNullableDecimal (object o, int index) { return Map.DefaultSchema.ConvertToNullableDecimal (GetValue(o, index)); } | |
67 public virtual Guid? GetNullableGuid (object o, int index) { return Map.DefaultSchema.ConvertToNullableGuid (GetValue(o, index)); } | |
68 public virtual DateTime? GetNullableDateTime(object o, int index) { return Map.DefaultSchema.ConvertToNullableDateTime(GetValue(o, index)); } | |
69 public virtual DateTimeOffset? GetNullableDateTimeOffset(object o, int index) { return Map.DefaultSchema.ConvertToNullableDateTimeOffset(GetValue(o, index)); } | |
70 | |
71 #if !SILVERLIGHT | |
72 | |
73 // SQL type getters. | |
74 // | |
75 public virtual SqlByte GetSqlByte (object o, int index) { return Map.DefaultSchema.ConvertToSqlByte (GetValue(o, index)); } | |
76 public virtual SqlInt16 GetSqlInt16 (object o, int index) { return Map.DefaultSchema.ConvertToSqlInt16 (GetValue(o, index)); } | |
77 public virtual SqlInt32 GetSqlInt32 (object o, int index) { return Map.DefaultSchema.ConvertToSqlInt32 (GetValue(o, index)); } | |
78 public virtual SqlInt64 GetSqlInt64 (object o, int index) { return Map.DefaultSchema.ConvertToSqlInt64 (GetValue(o, index)); } | |
79 public virtual SqlSingle GetSqlSingle (object o, int index) { return Map.DefaultSchema.ConvertToSqlSingle (GetValue(o, index)); } | |
80 public virtual SqlBoolean GetSqlBoolean (object o, int index) { return Map.DefaultSchema.ConvertToSqlBoolean (GetValue(o, index)); } | |
81 public virtual SqlDouble GetSqlDouble (object o, int index) { return Map.DefaultSchema.ConvertToSqlDouble (GetValue(o, index)); } | |
82 public virtual SqlDateTime GetSqlDateTime (object o, int index) { return Map.DefaultSchema.ConvertToSqlDateTime(GetValue(o, index)); } | |
83 public virtual SqlDecimal GetSqlDecimal (object o, int index) { return Map.DefaultSchema.ConvertToSqlDecimal (GetValue(o, index)); } | |
84 public virtual SqlMoney GetSqlMoney (object o, int index) { return Map.DefaultSchema.ConvertToSqlMoney (GetValue(o, index)); } | |
85 public virtual SqlGuid GetSqlGuid (object o, int index) { return Map.DefaultSchema.ConvertToSqlGuid (GetValue(o, index)); } | |
86 public virtual SqlString GetSqlString (object o, int index) { return Map.DefaultSchema.ConvertToSqlString (GetValue(o, index)); } | |
87 | |
88 #endif | |
89 | |
90 #endregion | |
91 } | |
92 } |