本文整理汇总了C#中Dialect类的典型用法代码示例。如果您正苦于以下问题:C# Dialect类的具体用法?C# Dialect怎么用?C# Dialect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dialect类属于命名空间,在下文中一共展示了Dialect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SqlDropString
/// <summary>
/// Get the SQL string to drop this Constraint in the database.
/// </summary>
/// <param name="dialect">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param>
/// <param name="defaultCatalog"></param>
/// <param name="defaultSchema"></param>
/// <returns>
/// A string that contains the SQL to drop this Constraint.
/// </returns>
public override string SqlDropString(Dialect.Dialect dialect, string defaultCatalog, string defaultSchema)
{
string ifExists = dialect.GetIfExistsDropConstraint(Table, Name);
string drop = string.Format("alter table {0}{1}", Table.GetQualifiedName(dialect, defaultCatalog, defaultSchema), dialect.GetDropPrimaryKeyConstraintString(Name));
string end = dialect.GetIfExistsDropConstraintEnd(Table, Name);
return ifExists + Environment.NewLine + drop + Environment.NewLine + end;
}
示例2: BuildSqlDropIndexString
public static string BuildSqlDropIndexString(Dialect.Dialect dialect, Table table, string name, string defaultCatalog, string defaultSchema)
{
string ifExists = dialect.GetIfExistsDropConstraint(table, name);
string drop = string.Format("drop index {0}", StringHelper.Qualify(table.GetQualifiedName(dialect, defaultCatalog, defaultSchema), name));
string end = dialect.GetIfExistsDropConstraintEnd(table, name);
return ifExists + Environment.NewLine + drop + Environment.NewLine + end;
}
示例3: BuildSQLExceptionConverter
/// <summary> Build a SQLExceptionConverter instance. </summary>
/// <param name="dialect">The defined dialect. </param>
/// <param name="properties">The configuration properties. </param>
/// <returns> An appropriate <see cref="ISQLExceptionConverter"/> instance. </returns>
/// <remarks>
/// First, looks for a <see cref="Cfg.Environment.SqlExceptionConverter"/> property to see
/// if the configuration specified the class of a specific converter to use. If this
/// property is set, attempt to construct an instance of that class. If not set, or
/// if construction fails, the converter specific to the dialect will be used.
/// </remarks>
public static ISQLExceptionConverter BuildSQLExceptionConverter(Dialect.Dialect dialect, IDictionary<string, string> properties)
{
ISQLExceptionConverter converter = null;
string converterClassName;
properties.TryGetValue(Cfg.Environment.SqlExceptionConverter, out converterClassName);
if (!string.IsNullOrEmpty(converterClassName))
{
converter = ConstructConverter(converterClassName, dialect.ViolatedConstraintNameExtracter);
}
if (converter == null)
{
log.Info("Using dialect defined converter");
converter = dialect.BuildSQLExceptionConverter();
}
IConfigurable confConv = converter as IConfigurable;
if (confConv != null)
{
try
{
confConv.Configure(properties);
}
catch (HibernateException e)
{
log.Warn("Unable to configure SQLExceptionConverter", e);
throw;
}
}
return converter;
}
示例4: DatabaseMetadata
public DatabaseMetadata(DbConnection connection, Dialect.Dialect dialect, bool extras)
{
schemaReader = new InformationSchemaReader(connection);
this.extras = extras;
InitSequences(connection, dialect);
sqlExceptionConverter = dialect.BuildSQLExceptionConverter();
}
示例5: MappingRootBinder
public MappingRootBinder(Mappings mappings, XmlNamespaceManager namespaceManager,
Dialect.Dialect dialect)
: base(mappings)
{
this.namespaceManager = namespaceManager;
this.dialect = dialect;
}
示例6: OracleManagedDriverTransformationProvider
public OracleManagedDriverTransformationProvider(Dialect dialect, string connectionString, string defaultSchema)
: base(dialect, connectionString, defaultSchema)
{
_connection = new OracleConnection();
_connection.ConnectionString = _connectionString;
_connection.Open();
}
示例7: SelectBuilder
public SelectBuilder(Dialect dialect, string[] tables, string[] columns) {
_dialect = dialect;
_tables = tables;
_columns = columns;
Parameters = new In[0];
}
示例8: ParseToString
public static string ParseToString(object o, Dialect.DbDialect dd)
{
if (o == null)
{
return "NULL";
}
var ot = o.GetType();
if ( typeof(bool) == ot )
{
return Convert.ToInt32(o).ToString();
}
if ( typeof(string) == ot )
{
string s = o.ToString();
s = s.Replace("'", "''");
return string.Format("N'{0}'", s);
}
if ( typeof(DateTime) == ot || typeof(Date) == ot || typeof(Time) == ot )
{
return dd.QuoteDateTimeValue(o.ToString());
}
if (ot.IsEnum)
{
return Convert.ToInt32(o).ToString();
}
if (typeof(byte[]) == ot)
{
throw new ApplicationException("Sql without Parameter can not support blob, please using Parameter mode.");
}
return o.ToString();
}
示例9: MySqlTransformationProvider
public MySqlTransformationProvider(Dialect dialect, string connectionString)
: base(dialect, connectionString)
{
connection = new MySqlConnection(base.connectionString);
connection.ConnectionString = base.connectionString;
connection.Open();
}
示例10: SqlCreateString
public override string SqlCreateString(
Dialect.Dialect dialect,
IMapping p,
string defaultSchema)
{
return InjectCatalogAndSchema(sqlCreateString, defaultSchema);
}
示例11: PostgreSQLTransformationProvider
public PostgreSQLTransformationProvider(Dialect dialect, string connectionString)
: base(dialect, connectionString)
{
connection = new NpgsqlConnection();
connection.ConnectionString = connectionString;
connection.Open();
}
示例12: Configure
/// <summary>
/// Configures the TableGenerator by reading the value of <c>table</c>,
/// <c>column</c>, and <c>schema</c> from the <c>parms</c> parameter.
/// </summary>
/// <param name="type">The <see cref="IType"/> the identifier should be.</param>
/// <param name="parms">An <see cref="IDictionary"/> of Param values that are keyed by parameter name.</param>
/// <param name="dialect">The <see cref="Dialect.Dialect"/> to help with Configuration.</param>
public virtual void Configure( IType type, IDictionary parms, Dialect.Dialect dialect )
{
this.tableName = PropertiesHelper.GetString( Table, parms, "hibernate_unique_key" );
this.columnName = PropertiesHelper.GetString( Column, parms, "next_hi" );
string schemaName = ( string ) parms[ Schema ];
if( schemaName != null && tableName.IndexOf( StringHelper.Dot ) < 0 )
{
tableName = schemaName + "." + tableName;
}
query = "select " + columnName + " from " + tableName;
if( dialect.SupportsForUpdate )
{
query += " for update";
}
// build the sql string for the Update since it uses parameters
Parameter setParam = new Parameter( columnName, new Int32SqlType() );
Parameter whereParam = new Parameter( columnName, new Int32SqlType() );
SqlStringBuilder builder = new SqlStringBuilder();
builder.Add( "update " + tableName + " set " )
.Add( columnName )
.Add( " = " )
.Add( setParam )
.Add( " where " )
.Add( columnName )
.Add( " = " )
.Add( whereParam );
updateSql = builder.ToSqlString();
}
示例13: AppliesTo
protected override bool AppliesTo(Dialect.Dialect dialect)
{
return !(dialect is Dialect.Oracle8iDialect);
// Oracle sometimes causes: ORA-12520: TNS:listener could not find available handler for requested type of server
// Following links bizarrely suggest it's an Oracle limitation under load:
// http://www.orafaq.com/forum/t/60019/2/ & http://www.ispirer.com/wiki/sqlways/troubleshooting-guide/oracle/import/tns_listener
}
示例14: GetQualifiedName
/// <summary>
/// Gets the schema qualified name of the Table using the specified qualifier
/// </summary>
/// <param name="dialect">The <see cref="Dialect.Dialect"/> that knows how to Quote the Table name.</param>
/// <param name="defaultQualifier">The Qualifier to use when accessing the table.</param>
/// <returns>A String representing the Qualified name.</returns>
/// <remarks>If this were used with MSSQL it would return a dbo.table_name.</remarks>
public string GetQualifiedName( Dialect.Dialect dialect, string defaultQualifier )
{
string quotedName = GetQuotedName( dialect );
return schema == null ?
( ( defaultQualifier == null ) ? quotedName : defaultQualifier + StringHelper.Dot + quotedName ) :
GetQualifiedName( dialect );
}
示例15: TransformationProvider
protected TransformationProvider(Dialect dialect, string connectionString, string schemaName)
{
_dialect = dialect;
_connectionString = connectionString;
_schemaName = schemaName;
_logger = new Logger(false);
}