我在我的代码中返回一个空值:(var cat 行)
public class CategoryItemsViewModel
{
public ICategoriesRepository categoriesRepository;
public IEnumerable<Categories> GetCategories()
{
var cat = categoriesRepository.Categories;
return cat;
}
}
这是界面:
namespace SportsStore.Domain.Abstract
{
public interface ICategoriesRepository
{
IQueryable<Categories> Categories { get; }
void SaveCategory(Categories category);
void DeleteCategory(Categories category);
}
}
这是课程:
namespace SportsStore.Domain.Entities
{
public class Categories
{
[Key]
public int CategoryID { get; set; }
public string CategoryName { get; set; }
}
}
我究竟做错了什么?