internal string SanitizeName(string objName, DialectEnum dialect) { var sanitizedFormat = "`{0}`"; if (dialect == DialectEnum.MSSQL) { sanitizedFormat = "[{0}]"; } return(string.Format(sanitizedFormat, objName)); }
private static string GetDefaultValue(bool isRequired, bool isGenerated, object defValue, DialectEnum dialect) { var valQuotesFormat = "('{0}')"; var valNoQuotesFormat = "({0})"; if (dialect == Enums.DialectEnum.MSSQL) { valQuotesFormat = "''{0}''"; } var defVal = defValue?.ToString(); if (defValue is bool boolean) { defVal = boolean ? string.Format(valNoQuotesFormat, "1") : string.Format(valNoQuotesFormat, "0"); } if (defValue is string) { defVal = string.Format(valQuotesFormat, defVal); } return(isRequired && !isGenerated && defValue != null ? $" DEFAULT {defVal}" : ""); }