I have a base class:
class MyBase
{
public int Id { get; set; }
public string CreatedBy { get; set; }
public DateTime CreateAt { get; set; }
}
There is a subclass with readonly properties inherited from the base class:
class MySub : MyBase
{
public string CreateAtStr{
get { return CreateAt.ToString("yyyy-MMM-dd", CultureInfo.InvariantCulture); }
}
}
I can only get results of MyBase type, I want them to be auto converted to MySub type. How to do it? BTW: base class is entity class and sub class is for the view so it needs some customization.