src/Misc/EFTools/EntityDesignModel/ModelHelper.cs
/// <summary>
///     Get entity model property max length facet value.
/// </summary>
/// <param name="columnSize"></param>
/// <returns></returns>
Get entity model property max length facet value.
Get entity model property max length facet value .
internal static StringOrPrimitive<uint> GetMaxLengthFacetValue(uint? columnSize)
        {
            StringOrPrimitive<uint> maxSize = null;
            if (columnSize != null)
            {
                if (columnSize >= (Int32.MaxValue / 2))
                {
                    maxSize = Property.MaxLengthMaxValueObject;
                }
                else
                {
                    maxSize = new StringOrPrimitive<uint>(columnSize.Value);
                }
            }
            return maxSize;
        }
internal static StringOrPrimitive < uint > GetMaxLengthFacetValue ( uint ? columnSize ) { StringOrPrimitive < uint > maxSize = null ; if ( columnSize != null ) { if ( columnSize >= ( Int32 . MaxValue / 2 ) ) { maxSize = Property . MaxLengthMaxValueObject ; } else { maxSize = new StringOrPrimitive < uint > ( columnSize . Value ) ; } } return maxSize ; }
Get entity model property max length facet value.
Get entity model property max length facet value .
// Decide whether to return "Max" or the columnSize parameter value. // Ideally we just need to check if columnSize value is equal to Int32.MaxValue; but unfortunately this does not work for some DB unicode types for example NText. // For NText and other unicode type, if the columnSize is Int32.MaxValue/2, MaxLength should be set to "Max". // I think it is pretty safe to assume if the columnSize >= Int32.MaxValue/2 then set the MaxLength to "Max" since in SQL Server you could not set column size to be greater than 8000.
None
columnSize
uint?
None