Beispiel #1
0
        private static string FieldDefault(PropertyConfig col)
        {
            var def = (col.Initialization == null)
                ? null
                : col.CsType == "string" ? $"DEFAULT '{col.Initialization}'" : $"DEFAULT {col.Initialization}";
            var nulldef  = col.CsType == "string" || col.DbNullable ? " NULL" : " NOT NULL";
            var identity = (col.IsIdentity ? " IDENTITY(1,1)" : null);

            return($"[{col.ColumnName}] {SqlServerHelper.ColumnType(col)}{identity}{nulldef} {def} -- '{col.Caption}'");
        }
Beispiel #2
0
 /// <summary>
 ///     从C#的类型转为My sql的类型
 /// </summary>
 /// <param name="column"> C#的类型</param>
 public static string ColumnType(PropertyConfig column)
 {
     return(SqlServerHelper.ColumnType(column));
 }