I'm starting with ASP.NET MVC, and working with NerdDinner as reference. I did the following:
Created a new project
Added a couple of tables
Created LINQ to SQL for them
Created a new controller
My Models directory now contains MyModel.dbml, under which I have MyModel.designer.cs, that contains classes for models relating to both of my tables (let's call them Categories and Products).
Now, under my new controller, I would like to create a strongly typed view. So for example I have the following code in my controller (for my application I must work by name, and the "Name" field is unique):
public ActionResult Details(string name)
{
MyModelDataContext db = new MyModelDataContext();
Product user = db.Products.Single(t => t.Name == name);
return View(user);
}
I would like to create a strongly-typed view. So I right-click the line "return View(user)", and choose "Add View...". I click "Create a strongly-typed view". When I click the dropdown of "View data class", I don't see my models, but only:
MyProject.Controllers.AccountMembershipService
MyProject.Controllers.FormsAuthenticationService
What am I missing?