ASP.NET MVC without database INSERTS - asp.net-mvc

I used asp.net web forms before and currently thinking to switch to MVC, the issue is, my current project is against a 'real time database' - PI from OSISoft - where I don't need CRUD operations at all, its a view only application; is the MVC model still applicable here or what?
Sorry for the newbie question.

ASP.NET MVC and Web Forms are web application frameworks. They don't define any constraints on data access. With a little refactoring you should be able to use same data access code (C# or VB) in an MVC application.

Funny, I just created a dashboard for a PI server. Used ASP.Net MVC and Web API to surface the information, it worked a treat.
Note MVC doesn't actually have anything to do with data persistence. It is simply a well-conceived UI design pattern.

Related

using ASP.NET MVC and EXT JS together

I'd like to use for my next project Ext js and ASP.NET MVC.
I'm wondering what would be the best way of using this two framework together. So far I did some project using ASP.NET MVC, where every action method returned a view and reloaded the page. The Ext js mvc application uses a single page approach.
As I'm pretty new to ext js so I'm wondering if someone could share some experiences of building real world application using this two frameworks.
You can use extjs as you think is better for you. You can use its components as simple widgets or create a full javascript (extjs) client. However, which are the real requirements? a single page client or a traditional client?
In our current project we started using ASP.Net MVC Framework with extjs widgets, it was ok for a while but the customer wanted more and more sophisticated UI and a better user experince (among other thing) then, we changed the app, we left MVC models and controllers (views were removed) and we created a full javascript client with extjs 4.1.
After that we realized we were using an ASP M_C framework (with no views) and that was a nonsense so, we took the ASP MVC project away and replaced it by a WCF Rest service (it also could be done with an ASP.Net Web Api).
We feel proud of our decision and the resulting design. If you can, if you know extjs (learning it is rather hard) and javascript and, if you have support to your decision then, keep your application splitted in two:
a server-side service/api and,
a full javascript application.
Good luck!
I'm not sure I'd agree with the answer by #lontivero, I'm currently working on a project using ASP.NET MVC as the backend and ExtJS as the front.
You do, as pointed out, loose the V from the ASP.NET MVC stack and you end up needing to duplicate you C# view models in you ExtJS Models on the client side but I've found using MVC as a backend (effectively as a rest based collection of Json end points) absolutely fine.
You can utilise the model binding, model validation in MVC whilst leveraging the full client side js app in Ext.
I'm curious as to the points you didn't get on with using this structure (I'm not saying it's perfect, but it does seem to work)
We used Ext.NET (versions 0.x-1.x) in our previous projects. Even after a comprehensive effort to upgrade our projects to the (now current) version, we had to drop Ext.Net 2.x out.
If it fits you, it can help.
The main problems with Ext.Net were (several) incompatibilities with ASP.NET and a lack of trust. They used to keep their schedule, it's far from it for last 2 years or so. And they are behind ExtJS.

Microsoft ASP .NET Web API, MVC 4 and SPA Architecture

Microsoft recently released MVC 4 Beta, which has these new very nice features like Web API and SPA. And as always Microsoft's demos do not demonstrate best practices from software design prospective. For example, using DbController which is tightly coupled to EF.
It seems for me that SPA and Web API go hand-by-hand in modern ASP .NET app.
I would like to hear any suggestions about structuring MVC 4-based solution, which is going to apply these new technologies like Web API and SPA.
For example, is it a good practice to separate Web API project with it's own controllers out of base MVC4 project or not. How to deal with SPA and not to use DbController in order to keep data persistence separately? What's going to be a main role of regular MVC4 app and especially Razor views?
Any other thoughts or suggestions are highly appreciated.
On separation of MVC4 + Web API: imho (as always) it depends on your concrete project.
Regarding EF: you should definitely not return EF Entities but return your own DTOs instead.
The role of MVC razor views could be rendering partial views you dynamically load from the client. You also could do some stuff like conditional loading of CSS / JS etc. for the Index page being loaded initially.
I think it's a good idea to keep the API in a separate web site project from your SPA/web site, as you can run in to problems with greedy routes.
Definitely keep your data access separate and loosely coupled.

HMVC reference architecture in .net

We are about to implement a large web forms application to asp.net mvc3. I just read about heirarchical MVC or HMVC. I found it to be a good concept. Are there any frameworks which already supports the same?
The application is majorly a intranet with a complicated UI. We are planning to have UI like Outlook webmail like interface. Also wanted feedback on whether its good to go with MVC or silverlight can be a point of consideration?
For your question about HMVC, I believe ASP.NET MVC does have HMVC since v2.0 in the form of Areas.
Couple that with T4MVC and calling Action.PartialX() methods and you've got yourself the next buzz-word HMVC.

Using Sencha's ExtJS MVC with ASP.NET MVC

I wanted to ask if anyone has tried using combination of Sencha's ExtJS 4 (using MVC approach) with ASP.NET MVC (using view models)?
I have existing ASP.NET MVC 3 app that uses view models and my question is how would this "fit" into Sencha's MVC approach...Would ASP.NET MVC "view model" become ExtJS "model" and then I would define yet another "view model" for ExtJS....Seems a lot of "translating"...
What would be the best approach?
And yes, I am aware of projects that integrate ASP.NET MVC with ExtJS using Ext.Direct, but my question is strictly relating to MVC paradigm on "both" sides (ASP.NET and Sencha ExtJS)
Thanks
Z...
Our approach currently is a what could be described as MVCCM or MVC-CM.
In ExtJs you have the view as panels and boxes etc, a store with a model makes a model and you need some logic to make these components work together which would be the controller.
This ExtJs frontend is situated in a MVC3 project and exposes controller methods that typically returns Json data which it gets from the model back end which is typically made up of entities.
There is no programmatic link between the entities on the server side and the models defined in the stores client side. One could generated the stores from entities, but we have not looked into this yet.
The view in the Microsoft MVC3 framework is just a page that returns some div tags which ExtJS can render stuff into.
While I've not done this with ExtJS, I really don't think there's any conflict. I'm assuming a lot here, I know, but if ExtJS works with JSON and you've got ASP.NET MVC actions that emit JSON, it's really more of a philosophic difference than a technical one.
One difference from a normal MVC app would be that your ASP.NET MVC app might not have any views, since the views would be handled entirely by ExtJS.
From the server side, ASP.NET MVC really doesn't care - it's getting a request that gets mapped to a controller and action, processing the request and returning some result. Whether that result is HTML, JSON, XML or whatever, ASP.NET doesn't care at all.

ASP.NET MVC with ADO.NET DataServices

In the project i am working on, i want to use the ADO.NET data services as data access layer. so that other parts of my application (except asp.net mvc web site) could also access it from the same location. I am just not sure if this si the correct model and also for asp.net mvc models I wanted to reuse the data services model, as much as possible and also some how decorate them as required fields etc.
Other option i started looking at was to use RIA services as back end to the MVC site.
I am very confued at the moment and any help would be appriceated.
Have you taken a look into WCF data services?
http://msdn.microsoft.com/en-us/data/bb931106.aspx

Resources