diff Source/Data/DataProvider/SybaseAdoDataProvider.cs @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Source/Data/DataProvider/SybaseAdoDataProvider.cs	Thu Mar 27 21:46:09 2014 +0400
@@ -0,0 +1,45 @@
+using System;
+using System.Data;
+using System.Data.OleDb;
+
+namespace BLToolkit.Data.DataProvider
+{
+	// Data Provider for DataDirect Sybase ADO Provider 4.2
+	//
+	public sealed class SybaseAdoDataProvider : OleDbDataProvider
+	{
+		public override bool DeriveParameters(IDbCommand command)
+		{
+			OleDbCommandBuilder.DeriveParameters((OleDbCommand)command);
+			return true;
+		}
+
+		public override object Convert(object value, ConvertType convertType)
+		{
+			switch (convertType)
+			{
+				case ConvertType.NameToQueryParameter:
+					return "?";
+
+				case ConvertType.NameToCommandParameter:
+				case ConvertType.NameToSprocParameter:
+					return value;
+			}
+
+			return base.Convert(value, convertType);
+		}
+
+		public override void AttachParameter(IDbCommand command, IDbDataParameter parameter)
+		{
+			if (parameter.Value is string && parameter.DbType == DbType.Guid)
+				parameter.DbType = DbType.AnsiString;
+
+			base.AttachParameter(command, parameter);
+		}
+
+		public override string Name
+		{
+			get { return "SybaseAdo"; }
+		}
+	}
+}