/// <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)); }
public SequenceStructure(Dialect.Dialect dialect, string sequenceName, int initialValue, int incrementSize) { this.sequenceName = sequenceName; this.initialValue = initialValue; this.incrementSize = incrementSize; sql = new SqlString(dialect.GetSequenceNextValString(sequenceName)); }
/// <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 parms, Dialect.Dialect dialect) { this.sequenceName = PropertiesHelper.GetString(Sequence, parms, "hibernate_sequence"); string schemaName = ( string )parms[Schema]; if (schemaName != null && sequenceName.IndexOf(StringHelper.Dot) < 0) { sequenceName = schemaName + '.' + sequenceName; } returnClass = type.ReturnedClass; sql = dialect.GetSequenceNextValString(sequenceName); }