There is a ready base in which nothing can be added. I made edmx out of it in the project. Now I need to add a calculated field that calculates age. I add the Age property to the essence, but the crash crashes.
Entity code:
public partial class Employee { public System.Guid ID { get; set; } public string LastName { get; set; } public string FirstName { get; set; } public string Patronymic { get; set; } public Nullable<System.DateTime> BirthDay { get; set; } public Nullable<System.Guid> DepartmentID { get; set; } [DatabaseGenerated(DatabaseGeneratedOption.Computed)] public int Age { get { if (BirthDay != null) return (DateTime.Now - BirthDay.Value).Days / 365; return 0; } set { } } } Self Exception
The LINK to Entities is a specified type of member. Only initializers, entity members, and entity navigation properties are supported.
How can I add a calculated field in my case?