views:

45

answers:

2

I'm rather new to MVC2 (never been in MCV1) though I'm a WebForms developer for some years now...

in my MCV 2 start project I created a App_Code folder that I would put my Business Classes on it, I also add 2 References to 2 DLLs used for the API I'm about to use.

But I don't get Intellisense on the referenced objects

What am I doing wrong?

alt text

Is this so much different from the WebForms part?


Added

Even if I put the Object in Models instead App_Code (where I normally put all code in WebForms) I still don't get the normal intelisense, so... it just tells me that something is wrong ... dang! MVC is hard! I probably should do this in WebForms...

alt text

A: 

See the Models directory -- that's where your model classes would go, assuming the class is a view model class. Having said that, it should be able to pick up and provide intellisense for whatever references you add. App_Code isn't really intended for a Web Application project (the type used by MVC) where the code is compiled statically, but rather for a WebSite where the code is compiled dynamically at runtime. It could be the "special" nature of the directory that is causing the problem because it doesn't fit the project type. You might try simply creating a different directory (if Models isn't appropriate) and not use the special App_Code directory for your code. A separate class library project with a project reference in the web application would be another alternative and is the one I usually use for non-viewmodel/controller code.

tvanfosson
A: 

This has nothing to do with MVC2, and everything to do with you're doing it wrong. I can tell that its a possibility, as you're using App_Code (I mean, who does that?). I'd definitely suggest backing up and reading some MVC tutorials, as it IS much different (although not in the way you're asking about).

I'm not exactly sure WHAT you're doing wrong, however. It might bethat PerceptiveMCAPI is internal to the assembly, it might be because there is a bug in VS, it might be that you haven't imported the correct namespace... it could be a number of different things.

I'd do the following: 1) load the assembly in reflector and make sure you have the namespace and type name and that it is public 2) use the fully qualified name of the type 3) compile, check all errors and 4) restart VS.

If all else fails, Connect.

Will
just add a 2nd image to show that even in Model I can get to my own object :(
balexandre
@bale there is something seriously screwed up there. Start fresh, create a new solution using the MVC templates. Create a model in the Models directory. Compile. Create a controller in the Controllers directory. Compile. Try to reference the model within the controller. If you cannot do this you've got bigger issues.
Will
Will... I did... I pressed new project > web > MVC2, then Add new class in Model and changed the AccountController... nothing more! :-( **added** : just deleted and created again... now works fine :-/ weird stuff!
balexandre