Building an application, before using a real database, just to get things work I can first use a hard-coded list as a fake, in-memory repository:
public class FakeProductsRepository
{
private static IQueryable<Product> fakeProducts = new List<Product> {
new Product{ ProductID = "xxx", Description = "xxx", Price = 1000},
new Product{ ProductID = "yyy", Description = "xxx", Price = 2000},
new Product{ ProductID = "zzz", Description = "xxx", Price = 3000}
}.AsQueryable();
public IQueryable<Product> Products
{
get { return fakeProducts; }
}
}
How to add a method to this class for adding new, not hard-coded items in this list dynamically?