简体   繁体   中英

Visual Studio solution “design” for multiple projects

I'm currently building a MVC 4 mobile site in jQuery Mobile, to compliment the regular desktop version (built in MVC 3).

I have added a project to my solution for the mobile site (so I have two projects).

Since I can re-use most models I just get them from the original project by including those models in my new mobile project.

I'm pretty fresh with .NET MVC so I need your guidence about best practices when it comes to multiple projects and what problems I might run into when deploying.

Im planning to deploy this mobile site either under a sub-domain (eg mobile.domain.com) or just as domain.com/mobile.

  1. Will the mobile project still be able to access the models after it's deployed?

  2. Do you somehow deploy the whole solution? And in that case, how do you decide that the mobile project should reside in a specific subdomain or folder?

  3. Is it a smart idea to just reference the models/classes from the original project, or will this somehow make it less flexible? I guess the other way is to copy the models to the mobile projects "Models" folder?

  4. How would you go about this?

Best regards Mikael

  1. Yes but you get the whole desktop assembled code as well.
  2. This one is semantics, you could have it either way. What would be easier for consumers? Maybe having it's own subdomain so m.yoursite.com.
  3. You could break the common models into its own project that both sites reference. This would allow you to make changes that will affect both and you may be able to release them independently.

One web project shouldn't be referencing the other. It is okay to move your models to another library that both web projects reference. You shouldn't need to copy your code.

I assume you need a separate project because you don't want to reuse your actions. There's no law that says you can't return a different view based on how the user uses your site. Just pass a different path to the View() method. This way you aren't duplicating all the controller logic, authentication logic, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM