Using models created by entity framework, when I use a partial class with metadata, I cannot access the attributes added with dataannotations.
Example:
public class ClientsMetadata
{
[NotMapped]
public string Name { get; set; }
}
[MetadataType(typeof(ClientsMetadata))]
public partial class Clients{}
When I use:
if (property.GetCustomAttributes(typeof(NotMappedAttribute), false).Length == 0)
It does not validate the Attribute.
Aucun commentaire:
Enregistrer un commentaire