本文整理汇总了C#中NHibernate.SqlTypes.SqlType类的典型用法代码示例。如果您正苦于以下问题:C# SqlType类的具体用法?C# SqlType怎么用?C# SqlType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlType类属于NHibernate.SqlTypes命名空间,在下文中一共展示了SqlType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetParameterSizes
// Used from SqlServerCeDriver as well
public static void SetParameterSizes(IDataParameterCollection parameters, SqlType[] parameterTypes)
{
for (int i = 0; i < parameters.Count; i++)
{
SetVariableLengthParameterSize((IDbDataParameter) parameters[i], parameterTypes[i]);
}
}
示例2: SetDefaultParameterSize
private static void SetDefaultParameterSize(IDbDataParameter dbParam, SqlType sqlType)
{
switch (dbParam.DbType)
{
case DbType.AnsiString:
case DbType.AnsiStringFixedLength:
dbParam.Size = MaxAnsiStringSize;
break;
case DbType.Binary:
if (sqlType is BinaryBlobSqlType)
{
dbParam.Size = MaxBinaryBlobSize;
}
else
{
dbParam.Size = MaxBinarySize;
}
break;
case DbType.Decimal:
dbParam.Precision = MaxPrecision;
dbParam.Scale = MaxScale;
break;
case DbType.String:
case DbType.StringFixedLength:
dbParam.Size = IsText(dbParam, sqlType) ? MaxStringClobSize : MaxStringSize;
break;
case DbType.DateTime2:
dbParam.Size = MaxDateTime2;
break;
case DbType.DateTimeOffset:
dbParam.Size = MaxDateTimeOffset;
break;
}
}
示例3: InitializeParameter
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
{
if (sqlType is NpgsqlExtendedSqlType && dbParam is NpgsqlParameter)
this.InitializeParameter(dbParam as NpgsqlParameter, name, sqlType as NpgsqlExtendedSqlType);
else
base.InitializeParameter(dbParam, name, sqlType);
}
示例4: GetTypeName
public override string GetTypeName(SqlType sqlType)
{
if (IsUnallowedDecimal(sqlType.DbType, sqlType.Precision))
return base.GetTypeName(new SqlType(sqlType.DbType, MAX_DECIMAL_PRECISION, sqlType.Scale));
return base.GetTypeName(sqlType);
}
示例5: InitializeParameter
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
{
var convertedSqlType = sqlType;
if (convertedSqlType.DbType == DbType.Currency)
convertedSqlType = new SqlType(DbType.Decimal);
base.InitializeParameter(dbParam, name, convertedSqlType);
}
示例6: GenerateCommand
public override IDbCommand GenerateCommand(CommandType type, SqlString sqlString, SqlType[] parameterTypes)
{
IDbCommand command = base.GenerateCommand(type, sqlString, parameterTypes);
SetParameterSizes(command.Parameters, parameterTypes);
return command;
}
示例7: InitializeParameter
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
{
base.InitializeParameter(dbParam, name, sqlType);
if (sqlType is StringClobSqlType)
{
((OracleParameter)dbParam).OracleType = OracleType.NClob;
}
}
示例8: InitializeParameter
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
{
base.InitializeParameter(dbParam, name, sqlType);
if (sqlType.LengthDefined)
{
dbParam.Size = sqlType.Length;
}
}
开发者ID:vladimir-goncharov,项目名称:always-encrypted-with-nhibernate,代码行数:9,代码来源:SizeAwareSqlClientDriver.cs
示例9: AddWhereFragment
public SqlDeleteBuilder AddWhereFragment(string columnName, SqlType type, string op)
{
if (!string.IsNullOrEmpty(columnName))
{
whereStrings.Add(ToWhereString(columnName, op));
parameterTypes.Add(type);
}
return this;
}
示例10: GenerateCommand
public override IDbCommand GenerateCommand(CommandType type, SqlString sqlString, SqlType[] parameterTypes)
{
IDbCommand command = base.GenerateCommand(type, sqlString, parameterTypes);
if (IsPrepareSqlEnabled)
{
SetParameterSizes(command.Parameters, parameterTypes);
}
return command;
}
示例11: GenerateCommand
public IDbCommand GenerateCommand(CommandType type, SqlString sqlString, SqlType[] parameterTypes)
{
var innerCommand = _innerDriver.GenerateCommand(type, sqlString, parameterTypes);
if (innerCommand is GlimpseProfileDbCommand)
return innerCommand;
var command = new GlimpseProfileDbCommand(innerCommand as DbCommand, _stats);
return command;
}
示例12: AdjustSqlType
private static SqlType AdjustSqlType(SqlType sqlType)
{
switch (sqlType.DbType)
{
case DbType.Guid:
return GuidSqlType;
default:
return sqlType;
}
}
示例13: GenerateCommand
public override IDbCommand GenerateCommand(CommandType type, SqlString sqlString, SqlType[] parameterTypes)
{
IDbCommand command = base.GenerateCommand(type, sqlString, parameterTypes);
if (prepareSql)
{
SqlClientDriver.SetParameterSizes(command.Parameters, parameterTypes);
}
return command;
}
示例14: InitializeParameter
/// <remarks>
/// This adds logic to ensure that a DbType.Boolean parameter is not created since
/// ODP.NET doesn't support it.
/// </remarks>
protected override void InitializeParameter(IDbDataParameter dbParam, string name, SqlType sqlType)
{
// if the parameter coming in contains a boolean then we need to convert it
// to another type since ODP.NET doesn't support DbType.Boolean
if (sqlType.DbType == DbType.Boolean)
{
sqlType = SqlTypeFactory.Int16;
}
base.InitializeParameter(dbParam, name, sqlType);
}
示例15: Generate
public IDbCommand Generate(CommandType type, SqlString sqlString, SqlType[] parameterTypes)
{
IDbCommand cmd = factory.ConnectionProvider.Driver.GenerateCommand(type, sqlString, parameterTypes);
LogOpenPreparedCommand();
if (log.IsDebugEnabled)
{
log.Debug("Building an IDbCommand object for the SqlString: " + sqlString.ToString());
}
commandsToClose.Add(cmd);
return cmd;
}