views:

52

answers:

1

I have an ASP.NET application with three areas. In the root of the application is a Models folder containing a hodgepodge of classes, including two DataContexts, some Repository classes, some ViewModel classes, some helper classes, and some business logic classes.

I'd like to create subfolders for each of these subcategories and move the associated files into the appropriate subfolder. However, I am noticing that this is breaking things. For example, if I move one of the DataContexts to a DataContext subfolder in the Models folder, I find that the code in the repositories can no longer see the DataContext type.

Which must mean that the Models folder has special meaning to the system. What am I missing here? Is there some way to "sensitize" the subfolders so that the other code can still see the implemented classes and namespaces? Or am I going about this the wrong way?

+2  A: 

Probably a namespacing issue? The model folder has no special meaning.

The ASP.NET MVC team has said something like before:

"The only reason the model folder exists is because people kept asking us where to put our model classes" ;)

jfar
But I haven't changed any of the namespaces. All I did was create a new folder under Models, and drag the DataContext.dbml into that folder.
Robert Harvey
You may have not changed namespacee but VS could be trying to be helpful by renaming things for you. I've seen that happen before.
jfar
You are correct; VS changed the namespace when I moved the file. Grf, what a pain. How do you turn that off?
Robert Harvey
Looks like it only does this with the DataContext objects anyway (so far). Thanks for pointing me in the right direction. This might be OK behavior if Visual Studio asked you if you wanted to do a global rename first.
Robert Harvey