I’m following the NerdDinner tutorial for MVC and have a question about setting up my repository. Here’s what I have so far…
using System;
using System.Collections.Generic;
using System.Linq;
namespace BusinessReviews.Models
{
public class ReviewsRepository
{
private BusinessReviewsDataContext db = new BusinessReviewsDataContext();
public IQueryable GetAllBusinesses()
{
return db.Businesses;
}
}
}
I know that my IQueryable should specify T. In the tutorial they put the table name where the T is, which in their case was “Dinner”. For my application I think it should be “Business”. Unfortunately Visual Studio is not recognizing the Business class. Any ideas on what could be wrong?
*Edit — per comment below, here’s what I am trying to write
public IQueryable<Business> GetAllBusinesses()
{
return db.Businesses;
}
Typically the error “Unknown type __” is caused by namespace problems. Make sure you are including the appropriate namespaces. When working with generated code it is helpful to look at the generated classes by examining the designer.cs files. There may also be instances where the name isn’t what you expected for some reason.