I think I have a part of my answer. Reading a lot more about TextTemplatesTransformations, I changed my Model1.tt to include:
System.ComponentModel.DataAnnotations;
i WriteProperty, EdmPropertyType. , > 60 . maxlength, , , . , WriteProperty, .
void WriteProperty(CodeGenerationTools code, EdmProperty edmProperty)
{
WriteProperty(Accessibility.ForProperty(edmProperty),
code.Escape(edmProperty.TypeUsage),
code.Escape(edmProperty),
code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
code.SpaceAfter(Accessibility.ForSetter(edmProperty)),edmProperty);
}
void WriteProperty(string accessibility, string type, string name, string getterAccessibility, string setterAccessibility,EdmProperty edmProperty = null)
{
if (type =="string")
{
int maxLength = 0;
bool bres = (edmProperty != null
&& Int32.TryParse(edmProperty.TypeUsage.Facets["MaxLength"].Value.ToString(), out maxLength));
if (maxLength > 60)
{
#>
[DataType(DataType.MultilineText)]
[MaxLength(<#=maxLength#>)]
<#+
}
else
if (maxLength < 61 && maxLength > 0)
{
#>
[MaxLength(<#=maxLength#>)]
<#+
}
else
if(maxLength <=0)
{
#>
[DataType(DataType.MultilineText)]
<#+
}
}
#>
<#=accessibility#> <#=type#> <#=name#> { <#=getterAccessibility#>get; <#=setterAccessibility#>set; }
<#+
}
, < # + # > , , TT.