tags:

views:

384

answers:

2

I'm trying to add a strongly-typed view to the sample app that's created when you create a new MVC project, but I'm not getting something. I added a "Warehouse.dbml" LINQ to SQL file in the Models folder, which contains one table. When I go to the Views folder and right-click and select Add | View, all I see under "Create a strongly-typed view" are the types that come with the sample app:

  • MyProject.AccountMembershipService
  • MyProject.FormsAuthenticationService

What step(s) am I missing for my table to be an available type?

A: 

Ran into the same thing today, and my own classes didn't show up in the dropdown box. Weird enough later on they did. Maybe you need to compile your project first ?

Also saw some other people on forums / blogs suffering from the same issue. If you just type the name of your model in the dropdown / textbox, does that work ?

Morph
+2  A: 

Have you tried looking in your web.config and including those namespaces?

<namespaces>
    <add namespace="System.Web.Mvc"/>
    <add namespace="System.Web.Mvc.Ajax"/>

You would add another element with something like

<add namespace="MyProject.Data" />

That should fix it.

Chad Moran
Yep, adding "MyProject.Models" as a namespace allowed me to see my table in the dropdown. Odd that it wouldn't do that automatically - a minor RC1 bug perhaps?
gfrizzle
Nope, it's always been like that.
Chad Moran