I have MVC application. In one of the views I need to show or return a light weight WPF xbap page (running in IE or Firefox).
What will be the best approach to combine these two technologies in one.
Perhaps you have to create 1 extra project with WPF XPAB and just attach like sub-project under IIS to the primary one and refer to that page.
Related
What can be the best way for architecting an ASP .Net MVC project, which have common web service part and multiple views for multiple devices. I have started with a JQuery mobile project, and have view for mobile devices. Now I need to add web api controllers that should work as web services. Also another View part is needed for desktop browsers.
Is it good to assign different Areas to group different Views?
Web Request Flow:
Route mobile client request to MVCController in Mobile Area, and desktop client request to MVCController in Desktop Area from RouteConfig
Call web api controller(common) from MVC controllers
Return corresponding View from MVC controller
Is there any better approach available to do the same? I am confused if webservices and multiple views in same project will increase the complexity.
I think a better approach would be to pursue a responsive design. Ideally you'd end up with just one view for multiple devices instead of multiple views for showing the same information.
Take a look at this explanation.
You can use the Bootstrap framework to achieve a responsive design that will play nicely on any device.
See http://twitter.github.io/bootstrap/
For the most parts, you wont need jQuery mobile.
I am starting a group uni project and we are using ASP MVC 3. We are going to have a mobile (web) component as well as a "traditional" web app. Some of the views will overlap (as in Incidents mobile view and Incidents ordinary view). ASP MVC 4 has the mobile features that we want, but we don't want to take chances with a Beta version.
What we were thinking of doing was having two MVC 3 projects in our solution, one for the mobile and one for the web app. Alternatively, we were thinking of having some mobile only controllers and having everything in one MVC project. For example (/AccountMobileController/Signup and /AccountController/Signup)?
What do you guys recommend? Is it silly to use ASP MVC 4 Beta?
You can get mobile view support fairly easily in MVC 3. Take a look at how they approached this on Stackoverflow.
http://kevinmontrose.com/2011/07/17/mobile-views-in-asp-net-mvc3/
For the most part, your controllers should be the same for mobile and full site, but the views will be different.
I'd say go for MVC4 Beta.
Although, yes, it is in Beta, it is ALMOST ready for production.
System.Web.Mvc has really not changed that much, and in reality the, "mobile templates" from MVC4 are mostly just Html, Css, and Js templates that come pre-bundled with the templates.
The main new mobile functionality in MVC4 is for swapping out views for different devices.
Plus the Web API is really awesome for creating an API.
http://www.asp.net/mvc/tutorials/mvc-4/aspnet-mvc-4-mobile-features
I'd suggest you to look at frameworks like Bootstrap and Less, they'll help you build responsive websites without too much effort. Just be careful that you do not inject any css or styles from mvc code as it might interfere with them.
I'm designing a Module that is to be consumed by two distinct WebSites. Everything will be written in MVC (the module and both web applications).
I would like to design my module so that the code can be included from a shared location. I only want to maintain a single version. My first thought was the Area feature of MVC 2. But from my reading it appears as though MVC 2 only "officially" supports Inline Areas.
It sounds like MultiProject support for Areas could be dropped in the near future. What are the pros and cons of Areas implemented as single projects vs multiple projects in asp.net mvc
Are there any alternatives?
A real world example of my design would be creating an MVC Shopping Cart (this would be the shared Module) and consuming it on two different MVC web sites (say a Book Store and a Bicycle Parts Store).
MVC Contrib's Portable Areas are just what you need:
http://www.lostechies.com/blogs/hex/archive/2009/11/01/asp-net-mvc-portable-areas-via-mvccontrib.aspx
My experience has been nothing but positive. Have 3 apps sharing 3 portable areas. One is going into production pretty soon.
You can still make it an Area, maintain it in one place and copy it to other projects when needed. There's no way I know to make it work out of the box without setting up the appropriate routes in the consuming web project.
Other than that, I would be interested in a solution too.
Background: I currently have a Web Forms, ASP.NET 3.5/C# application which I'm interested in converting to MVC 2. It's a relatively tiny app so the exercise shouldn't take too long. The two primary functions the appliction does is allow users to
1) view and enter their data - metrics
2) view output reports of this data aggreggated at a higher level.
This second point is of concern to me as my first impression of MVC is that most of the reporting tools do not work with it. I'm currently using ReportViewer for 2) but I read here and on other sites that configuring it to work with MVC is a pain.
Are there any other types of Reporting capabilities that I could use with MVC 2? Are there some that work "out of the box"?
Or in your experience of using MVC 2, would it be easier to put together your own report? My requirement is to make a report that is similar to ReportViewer's Matrix style, with a few merged cells and a drill down by two levels. Don't know if that's way too complicated to do with MVC from scratch or not.
EDIT: Bonus if you know of any other Reporting add-ons that work with MVC besdies ReportViewer.
I have used the RDLC local reports to do this but I don't use the report viewer (even in webforms). I always stream the report straight to PDF. This works great in MVC as well since in this case I am avoiding the report viewer control.
This tutorial/post shows how to stream in MVC.
Please check my tutorial about reportviewer and mvc2 -> How to use ReportViewer 2010 in MVC.NET 2
Hope it helps you
Is there any reason that MVC isn't equally useful for desktop apps as for web apps?
What would be required to make an ASP.NET MVC directory tree implementable as a desktop app?
Prism
I've always thought of the term MVC as the same as a n-layer application - so correct me if I'm wrong here folks.
When i develope, I always(unless other instructed) use the following model/structure, also in applications:
GUI(Web, Winform, whatever) ->
Business logic ->
Data layer ->
And also with an underlying "Model"
... Which is a sort of MVC - So yes, it is usefull for desktop apps also. The main advantage with this, is that you can develope web, win and mobile(++) applications based on the same code.
Another thing that could be done, is to create the data/businesslayers as web-services...
I think this aproach would qualify as SOA.
EDIT:
As a note, the four levels of applications are created as seperate projects - and then used as adding reference to either the project, or the DLL, or from the GAC(or wherever you like.....) :) Thus, the need for a directory structure is not needed.
Hmmm... well, your view can be rendered as anything... HTML, XML, etc. So, why not XAML? I wonder if you can get your WPF or Silverlight app to work in the MVC framework this way... that is, not requiring a web server to run.
There is nothing stopping you from using the MVC pattern in a desktop app. In fact, it has been used on the desktop since before there was a web.
See Wikipedia for some examples
MVC just stands for "Model View Controller" which describes the way that concerns are separated from each other using the MVC pattern.
As far as using ASP.NET MVC on the desktop, there are a few problems. For one thing, it relies on HTTP requests and responses. You would need a server layer as part of your application architecture to listen for requests and send responses. Second, ASP.NET MVC views are really just simple HTML text files meant to be interpreted by a web browswer. So, you would need an HTML rendering component as a GUI front-end. You would likely want a CSS rendering engine and a JavaScript interpreter as well.
Basically, all you would be doing is running a dedicated browser as the front-end and a local web server as the back end.
There is really not much need since there are many great MVC frameworks already. There are also closely related patterns like MVP (Model View Presenter) and MVVM (Model-View-View Model). For example, many WPF (Windows Presentation Framework) apps are MVVM.