本文整理汇总了C#中Dialect类的典型用法代码示例。如果您正苦于以下问题:C# Dialect类的具体用法?C# Dialect怎么用?C# Dialect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dialect类属于命名空间,在下文中一共展示了Dialect类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:16,代码来源:PrimaryKey.cs
示例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;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:Index.cs
示例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;
}
开发者ID:ray2006,项目名称:WCell,代码行数:43,代码来源:SQLExceptionConverterFactory.cs
示例4: DatabaseMetadata
public DatabaseMetadata(DbConnection connection, Dialect.Dialect dialect, bool extras)
{
schemaReader = new InformationSchemaReader(connection);
this.extras = extras;
InitSequences(connection, dialect);
sqlExceptionConverter = dialect.BuildSQLExceptionConverter();
}
开发者ID:ray2006,项目名称:WCell,代码行数:7,代码来源:DatabaseMetadata.cs
示例5: MappingRootBinder
public MappingRootBinder(Mappings mappings, XmlNamespaceManager namespaceManager,
Dialect.Dialect dialect)
: base(mappings)
{
this.namespaceManager = namespaceManager;
this.dialect = dialect;
}
开发者ID:zibler,项目名称:zibler,代码行数:7,代码来源:MappingRootBinder.cs
示例6: OracleManagedDriverTransformationProvider
public OracleManagedDriverTransformationProvider(Dialect dialect, string connectionString, string defaultSchema)
: base(dialect, connectionString, defaultSchema)
{
_connection = new OracleConnection();
_connection.ConnectionString = _connectionString;
_connection.Open();
}
开发者ID:modulexcite,项目名称:Migrator.NET,代码行数:7,代码来源:OracleManagedDriverTransformationProvider.cs
示例7: SelectBuilder
public SelectBuilder(Dialect dialect, string[] tables, string[] columns) {
_dialect = dialect;
_tables = tables;
_columns = columns;
Parameters = new In[0];
}
开发者ID:SharpTools,项目名称:sharpdata,代码行数:7,代码来源:SelectBuilder.cs
示例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();
}
开发者ID:991899783,项目名称:DbEntry,代码行数:31,代码来源:DataTypeParser.cs
示例9: MySqlTransformationProvider
public MySqlTransformationProvider(Dialect dialect, string connectionString)
: base(dialect, connectionString)
{
connection = new MySqlConnection(base.connectionString);
connection.ConnectionString = base.connectionString;
connection.Open();
}
开发者ID:svn2github,项目名称:ecm7migrator,代码行数:7,代码来源:MySqlTransformationProvider.cs
示例10: SqlCreateString
public override string SqlCreateString(
Dialect.Dialect dialect,
IMapping p,
string defaultSchema)
{
return InjectCatalogAndSchema(sqlCreateString, defaultSchema);
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:7,代码来源:SimpleAuxiliaryDatabaseObject.cs
示例11: PostgreSQLTransformationProvider
public PostgreSQLTransformationProvider(Dialect dialect, string connectionString)
: base(dialect, connectionString)
{
connection = new NpgsqlConnection();
connection.ConnectionString = connectionString;
connection.Open();
}
开发者ID:svn2github,项目名称:ecm7migrator,代码行数:7,代码来源:PostgreSQLTransformationProvider.cs
示例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();
}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:40,代码来源:TableGenerator.cs
示例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
}
开发者ID:NikGovorov,项目名称:nhibernate-core,代码行数:7,代码来源:Fixture.cs
示例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 );
}
开发者ID:rcarrillopadron,项目名称:nhibernate-1.0.2.0,代码行数:14,代码来源:Table.cs
示例15: TransformationProvider
protected TransformationProvider(Dialect dialect, string connectionString, string schemaName)
{
_dialect = dialect;
_connectionString = connectionString;
_schemaName = schemaName;
_logger = new Logger(false);
}
开发者ID:X0nic,项目名称:Migrator.NET,代码行数:7,代码来源:TransformationProvider.cs
示例16: OracleTransformationProvider
public OracleTransformationProvider(Dialect dialect, string connectionString)
: base(dialect, connectionString)
{
connection = new OracleConnection();
connection.ConnectionString = base.connectionString;
connection.Open();
}
开发者ID:svn2github,项目名称:ecm7migrator,代码行数:7,代码来源:OracleTransformationProvider.cs
示例17: Configure
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="parms"></param>
/// <param name="d"></param>
public void Configure(IType type, IDictionary<string, string> parms, Dialect.Dialect d)
{
string tableList;
string column;
string schema;
string catalog;
if (!parms.TryGetValue("tables", out tableList))
parms.TryGetValue(PersistentIdGeneratorParmsNames.Tables, out tableList);
string[] tables = StringHelper.Split(", ", tableList);
if (!parms.TryGetValue("column", out column))
parms.TryGetValue(PersistentIdGeneratorParmsNames.PK, out column);
returnClass = type.ReturnedClass;
parms.TryGetValue(PersistentIdGeneratorParmsNames.Schema, out schema);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Catalog, out catalog);
StringBuilder buf = new StringBuilder();
for (int i = 0; i < tables.Length; i++)
{
if (tables.Length > 1)
{
buf.Append("select ").Append(column).Append(" from ");
}
buf.Append(Table.Qualify(catalog, schema, tables[i]));
if (i < tables.Length - 1)
buf.Append(" union ");
}
if (tables.Length > 1)
{
buf.Insert(0, "( ").Append(" ) ids_");
column = "ids_." + column;
}
sql = "select max(" + column + ") from " + buf;
}
开发者ID:pallmall,项目名称:WCell,代码行数:41,代码来源:IncrementGenerator.cs
示例18: SqlConstraintString
/// <summary>
/// Generates the SQL string to create the named Foreign Key Constraint in the database.
/// </summary>
/// <param name="d">The <see cref="Dialect.Dialect"/> to use for SQL rules.</param>
/// <param name="constraintName">The name to use as the identifier of the constraint in the database.</param>
/// <param name="defaultSchema"></param>
/// <param name="defaultCatalog"></param>
/// <returns>
/// A string that contains the SQL to create the named Foreign Key Constraint.
/// </returns>
public override string SqlConstraintString(Dialect.Dialect d, string constraintName, string defaultCatalog, string defaultSchema)
{
string[] cols = new string[ColumnSpan];
string[] refcols = new string[ColumnSpan];
int i = 0;
IEnumerable<Column> refiter;
if (IsReferenceToPrimaryKey)
refiter = referencedTable.PrimaryKey.ColumnIterator;
else
refiter = referencedColumns;
foreach (Column column in ColumnIterator)
{
cols[i] = column.GetQuotedName(d);
i++;
}
i = 0;
foreach (Column column in refiter)
{
refcols[i] = column.GetQuotedName(d);
i++;
}
string result = d.GetAddForeignKeyConstraintString(constraintName, cols, referencedTable.GetQualifiedName(d, defaultCatalog, defaultSchema), refcols, IsReferenceToPrimaryKey);
return cascadeDeleteEnabled && d.SupportsCascadeDelete ? result + " on delete cascade" : result;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:35,代码来源:ForeignKey.cs
示例19: Configure
/// <summary>
/// Configures the SequenceGenerator by reading the value of <c>sequence</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<string, string> parms, Dialect.Dialect dialect)
{
var nativeSequenceName = PropertiesHelper.GetString(Sequence, parms, "hibernate_sequence");
bool needQuote = StringHelper.IsBackticksEnclosed(nativeSequenceName);
bool isQuelified = nativeSequenceName.IndexOf('.') > 0;
if (isQuelified)
{
string qualifier = StringHelper.Qualifier(nativeSequenceName);
nativeSequenceName = StringHelper.Unqualify(nativeSequenceName);
nativeSequenceName = StringHelper.PurgeBackticksEnclosing(nativeSequenceName);
sequenceName = qualifier + '.' + (needQuote ? dialect.QuoteForTableName(nativeSequenceName) : nativeSequenceName);
}
else
{
nativeSequenceName = StringHelper.PurgeBackticksEnclosing(nativeSequenceName);
sequenceName = needQuote ? dialect.QuoteForTableName(nativeSequenceName) : nativeSequenceName;
}
string schemaName;
string catalogName;
parms.TryGetValue(Parameters, out parameters);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Schema, out schemaName);
parms.TryGetValue(PersistentIdGeneratorParmsNames.Catalog, out catalogName);
if (!isQuelified)
{
sequenceName = dialect.Qualify(catalogName, schemaName, sequenceName);
}
identifierType = type;
sql = new SqlString(dialect.GetSequenceNextValString(sequenceName));
}
开发者ID:renefc3,项目名称:nhibernate,代码行数:38,代码来源:SequenceGenerator.cs
示例20: Configure
/// <summary>
/// Configures the TableHiLoGenerator by reading the value of <c>table</c>,
/// <c>column</c>, <c>max_lo</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 override void Configure(IType type, IDictionary<string, string> parms, Dialect.Dialect dialect)
{
base.Configure(type, parms, dialect);
maxLo = PropertiesHelper.GetInt64(MaxLo, parms, Int16.MaxValue);
lo = maxLo + 1; // so we "clock over" on the first invocation
returnClass = type.ReturnedClass;
}
开发者ID:jlevitt,项目名称:nhibernate-core,代码行数:14,代码来源:TableHiLoGenerator.cs
注:本文中的Dialect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论