Beispiel #1
0
        public static string EFGetCodeMaxLengthString(this ColumnBase column)
        {
            string retVal = null;

            if (column.DataType == System.Data.SqlDbType.Binary ||
                column.DataType == System.Data.SqlDbType.Char ||
                column.DataType == System.Data.SqlDbType.NChar ||
                column.DataType == System.Data.SqlDbType.NVarChar ||
                column.DataType == System.Data.SqlDbType.Timestamp ||
                column.DataType == System.Data.SqlDbType.VarBinary ||
                column.DataType == System.Data.SqlDbType.VarChar ||
                column.DataType == System.Data.SqlDbType.Xml)
            {
                retVal = column.GetLengthString();
                if (retVal.ToLower() == "max")
                {
                    retVal = "Max";
                }
            }
            else if (column.DataType == System.Data.SqlDbType.Image ||
                     column.DataType == System.Data.SqlDbType.NText ||
                     column.DataType == System.Data.SqlDbType.Text)
            {
                retVal = "Max";
            }
            return(retVal);
        }
Beispiel #2
0
        public static string EFGetDatabaseMaxLengthString(this ColumnBase column)
        {
            string retVal = null;

            if (column.DataType == System.Data.SqlDbType.Binary ||
                column.DataType == System.Data.SqlDbType.Char ||
                column.DataType == System.Data.SqlDbType.NChar ||
                column.DataType == System.Data.SqlDbType.NVarChar ||
                column.DataType == System.Data.SqlDbType.VarBinary ||
                column.DataType == System.Data.SqlDbType.VarChar)
            {
                if (column.GetLengthString().ToLower() != "max")
                {
                    retVal = column.GetLengthString();
                }
            }
            return(retVal);
        }
Beispiel #3
0
        public static string EFSqlDatabaseType(this ColumnBase column, bool appendMax)
        {
            string retVal;

            retVal = column.DataType.ToString().ToLower();
            if (column.GetLengthString().ToLower() == "max" && appendMax)
            {
                retVal += "(max)";
            }
            return(retVal);
        }