using System.Collections.Generic;
public interface EntityRepository
BaseEntity GetById(int Id);
public class CourseRepository : EntityRepository
public BaseEntity GetById(int Id)
return new Course {Title = "Title", Description="descr", Price = 0, CategoryId = 1};
public static void Main()
CourseRepository cr = new CourseRepository();
Console.WriteLine("{0}, {1}, {2}", ((Course)cr.GetById(1)).Title, ((Course)cr.GetById(1)).Description, ((Course)cr.GetById(1)).Price);
public int Id { get; set; }
public class Course : BaseEntity
public string Title { get; set; }
public string Description { get; set; }
public decimal? Price { get; set; }
public int CategoryId { get; set; }