comparison Source/Data/DataProvider/SybaseAdoDataProvider.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;
3 using System.Data.OleDb;
4
5 namespace BLToolkit.Data.DataProvider
6 {
7 // Data Provider for DataDirect Sybase ADO Provider 4.2
8 //
9 public sealed class SybaseAdoDataProvider : OleDbDataProvider
10 {
11 public override bool DeriveParameters(IDbCommand command)
12 {
13 OleDbCommandBuilder.DeriveParameters((OleDbCommand)command);
14 return true;
15 }
16
17 public override object Convert(object value, ConvertType convertType)
18 {
19 switch (convertType)
20 {
21 case ConvertType.NameToQueryParameter:
22 return "?";
23
24 case ConvertType.NameToCommandParameter:
25 case ConvertType.NameToSprocParameter:
26 return value;
27 }
28
29 return base.Convert(value, convertType);
30 }
31
32 public override void AttachParameter(IDbCommand command, IDbDataParameter parameter)
33 {
34 if (parameter.Value is string && parameter.DbType == DbType.Guid)
35 parameter.DbType = DbType.AnsiString;
36
37 base.AttachParameter(command, parameter);
38 }
39
40 public override string Name
41 {
42 get { return "SybaseAdo"; }
43 }
44 }
45 }