public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { var enumLine = string.Join(", ", Values.Select(v => compiler.EscapeString(v.Trim()))); return(compiler.TransformKeywordCase("check ({0} in ({1}))") .Args( compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName), enumLine )); }
public override string GetColumnAutoGeneratedScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { switch (compiler.Target) { case TargetType.MySQL: return("AUTO_INCREMENT"); case TargetType.PostgreSQL: { var seq = "SEQ_{0}_{1}".Args(column.ParentEntity.TransformedShortName, column.TransformedShortName); outputs[RDBMSCompiler.SEQUENCES_OUTPUT].AppendLine("CREATE SEQUENCE {0} START 0;".Args(seq)); return("default nextval('{0}')".Args(seq)); } case TargetType.MsSQLServer: return("IDENTITY(1,1)"); default: return(string.Empty); } }
public override void TransformEntityName(RDBMSEntity entity) { base.TransformEntityName(entity); switch (NameCaseSensitivity) { case NameCaseSensitivity.ToLower: entity.TransformedName = entity.TransformedName.ToLowerInvariant(); entity.TransformedShortName = entity.TransformedShortName.ToLowerInvariant(); break; case NameCaseSensitivity.ToUpper: entity.TransformedName = entity.TransformedName.ToUpperInvariant(); entity.TransformedShortName = entity.TransformedShortName.ToUpperInvariant(); break; } }
/////////// <summary> /////////// Returns true to indicate that column of this type is unique /////////// </summary> /////////// <param name="context">The context that the result depends on </param> ////////public abstract bool? GetColumnUniqueConstraint(Compiler compiler); /// <summary> /// Returns script for check constraint on column level /// </summary> public virtual string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) => string.Empty;
/// <summary> /// Returns script for auto-generated values, may also emit compiler-specific object like sequence or generator /// </summary> public virtual string GetColumnAutoGeneratedScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) => string.Empty;
/// <summary> /// Changes column name, i.e. adds prefix /// </summary> public virtual void TransformColumnName(RDBMSCompiler compiler, RDBMSEntity column) { }
/// <summary> /// Returns script for default values, may also emit compiler-specific object like sequence or generator or insert rows in some other table /// </summary> public virtual string GetColumnDefaultScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return(string.Empty); }
public override void TransformColumnName(RDBMSCompiler compiler, RDBMSEntity column) { column.TransformedName = "G_{0}".Args(column.TransformedName); }
public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return(compiler.TransformKeywordCase("check ({0} > 0 and {0} < 200)").Args(compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName))); }
public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return compiler.TransformKeywordCase("check ({0} > 0 and {0} < 200)").Args( compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName) ); }
public override string GetColumnAutoGeneratedScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { switch(compiler.Target) { case TargetType.MySQL: return "AUTO_INCREMENT"; case TargetType.PostgreSQL: { var seq = "SEQ_{0}_{1}".Args(column.ParentEntity.TransformedShortName, column.TransformedShortName); outputs[RDBMSCompiler.SEQUENCES_OUTPUT].AppendLine("CREATE SEQUENCE {0} START 0;".Args(seq)); return "default nextval('{0}')".Args(seq); } case TargetType.MsSQLServer: return "IDENTITY(1,1)"; default: return string.Empty; } }
public override string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { var enumLine = string.Join(", ", Values.Select(v => compiler.EscapeString( v.Trim() )) ); return compiler.TransformKeywordCase("check ({0} in ({1}))") .Args( compiler.GetQuotedIdentifierName(RDBMSEntityType.Column, column.TransformedName), enumLine ); }
/////////// <summary> /////////// Returns true to indicate that column of this type is unique /////////// </summary> /////////// <param name="context">The context that the result depends on </param> ////////public abstract bool? GetColumnUniqueConstraint(Compiler compiler); /// <summary> /// Returns script for check constraint on column level /// </summary> public virtual string GetColumnCheckScript(RDBMSCompiler compiler, RDBMSEntity column, Compiler.Outputs outputs) { return string.Empty; }