Reputation: 33980
I'm starting with ASP.NET MVC, and working with NerdDinner as reference. I did the following:
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:
What am I missing?
Upvotes: 1
Views: 275
Reputation:
Recompile your project, the just added model classes do not appear in the list until you've recompiled.
Upvotes: 4