I have a following like classes which i am using as model for entity framework core for one of my table. After saving i am passing the object for some sort of caching work. How can i get the TableName and the value of the field which is marked as Key (i am using single field as Key)
[Table("audit_log")]
public class AuditLog
{
[Key]
public long auditlog_id { get; set; }
[Required]
public string appname { get; set; }
}
TableName is from System.ComponentModel.DataAnnotations.Schema Key is from System.ComponentModel.DataAnnotations
I have worked with my own custom attributes but here wanted to check if there is some buildin way of accessing these values. I have to pass the object and get tablename and value of the key
Thanks a lot Serge. Following is my solution at the moment