private static string getDataType(SQLProperty property) { var dataType = property.Type.ToLower(); var isMaxType = maxTypes.Contains(dataType); if (isMaxType) { return(handleMaxTypes(property, dataType)); } return(dataType); }
private static string handleMaxTypes(SQLProperty property, string dataType) { if (dataType.Contains("max")) { return($"{ dataType.Replace("max", "") }(max)"); } else { return($"{ dataType }({ property.Length })"); } }
private static IEnumerable <SQLProperty> getProperties(Enum.Language language, ColumnCollection columns) { var properties = new List <SQLProperty>(); foreach (Column column in columns) { var property = new SQLProperty { DefaultValue = column.DefaultConstraint?.Text, Length = column.DataType.MaximumLength, Name = NameFactory.Create(column.Name), Nullable = column.Nullable, PrimaryKey = column.InPrimaryKey, SqlDataType = column.DataType.SqlDataType, Type = getDataType(language, column.DataType.SqlDataType), IsInPrimaryKey = column.InPrimaryKey }; properties.Add(property); } return(properties); }