To achieve this you have to create a 2nd partial class for each entity class in EF and link it to a auxiliary class with substitute properties.
for example you have a generated
class Product { public int UnitPrice{ get; set; } }
The generated class will always be marked as partial.
and now you have to create 2nd partial class file and add
[MetadataType(typeof(ProductMetadata))]
public partial class Product
{
}
public class ProductMetadata
{
[Range(1, 5, ErrorMessage = "Enter a value between 1 and 5")]
public int UnitPrice { get; set; }
}
It will work.
Rate it if you find it as useful.