public class ProductData
{
private static ObservableCollection<Product> _products;
public static ObservableCollection<Product> Products
{
get
{
if (_products == null)
{
_products = CreateProducts();
}
return _products;
}
}
private static ObservableCollection<Product> CreateProducts()
{
return new ObservableCollection<Product>
{
new Product
{
ProductID = 1,
ProductName = "Chai",
Category = new Category()
{
CategoryID = 1,
CategoryName = "Beverages",
Description = "Soft drinks, coffees, teas, beers, and ales"
},
},
new Product
{
ProductID = 2,
ProductName = "Chang",
Category = new Category()
{
CategoryID = 1,
CategoryName = "Beverages",
Description = "Soft drinks, coffees, teas, beers, and ales"
},
},
new Product
{
ProductID = 77,
ProductName = "Original Frankfurter grune So?e",
Category = new Category()
{
CategoryID = 2,
CategoryName = "Condiments",
Description = "Sweet and savory sauces, relishes, spreads, and seasonings"
},
},
new Product
{
ProductID = 72,
ProductName = "Mozzarella di Giovanni",
Category = new Category()
{
CategoryID = 4,
CategoryName = "Dairy Product",
Description = "Cheeses"
},
},
};
}
}