comparison UnitTests/CS/DataAccess/TestQueryAttribute.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
3 using BLToolkit.Data.DataProvider;
4 using BLToolkit.DataAccess;
5
6 namespace DataAccess
7 {
8 public class TestQueryAttribute : SqlQueryAttribute
9 {
10 public TestQueryAttribute()
11 {
12 IsDynamic = true;
13 }
14
15 private string _accessText;
16 public string AccessText
17 {
18 get { return _accessText; }
19 set { _accessText = value; }
20 }
21
22 private string _oracleText;
23 public string OracleText
24 {
25 get { return _oracleText; }
26 set { _oracleText = value; }
27 }
28
29 private string _fbText;
30 public string FbText
31 {
32 get { return _fbText; }
33 set { _fbText = value; }
34 }
35
36 private string _SQLiteText;
37 public string SQLiteText
38 {
39 get { return _SQLiteText; }
40 set { _SQLiteText = value; }
41 }
42
43 public override string GetSqlText(DataAccessor accessor, BLToolkit.Data.DbManager dbManager)
44 {
45 switch (dbManager.DataProvider.Name)
46 {
47 case ProviderName.MsSql :
48 case ProviderName.SqlCe : return SqlText;
49
50 case ProviderName.Access : return AccessText ?? SqlText;
51
52 case "Oracle":
53 case ProviderName.Oracle : return OracleText ?? SqlText;
54
55 case ProviderName.Firebird: return FbText ?? SqlText;
56
57 case ProviderName.SQLite : return SQLiteText ?? SqlText;
58 }
59
60 throw new ApplicationException(string.Format("Unknown data provider '{0}'", dbManager.DataProvider.Name));
61 }
62 }
63 }