ASP.Net MVC is it passive model or active model - asp.net-mvc

As the subject states, is the mvc model that is used in ASP.Net MVC an active or passive model and why.

#joa. I've read up on the website at the link provided and you are indeed correct.
VS2010 creates a passive asp.net mvc project for you. Its then up to you to modify it into an active mvc model.
By default dev's go along with the passive model (looking at the many, many examples of asp.net mvc). Implementing the active model requires a bit more work though.
Ref: http://martinfowler.com/eaaDev/uiArchs.html

Related

Ready to use admin views for ASP.NET MVC project?

I have a an ASP.NET MVC5 project using Entity Framework. I have all the regular membership entities (AspNetUser, AspNetRole, ...). In the RoR or Django world we can add admin views extremely easily and I wonder if the ASP.NET MVC eco-system has anything similar to offer.
I'm thinking about admin views for tasks as listing users, editing user's roles, changing user fields, etc. within the standard membership realm.
I know I could scaffold views (with more plumbing code than what I'd use with Django), but I'm pretty sure I wouldn't be the first one who'd create views for managing users for standard ASP.NET MVC membership setup. I made more than enough Google searches, but I only find articles about the membership provider system.
Ideally I'm looking for a NuGet package.
I'm afraid currently we don't have one but you can use https://code.msdn.microsoft.com/ASPNET-MVC-5-Security-And-44cbdb97 project to work as your administration.

What pattern to use with aspnet mvc?

I always used asp.net webforms with the MVP pattern, it works great for what I need, I basically create a project where all my business rules reside, validation etc... and I then implement my views in the webforms project.
Now we're starting to use asp.net MVC and using the MVP patter doesn't make much sense, right? So what could be a good approach to create a scalable and testable project using MVC that won't make me create my data objects and do validation on the controllers. I don' want to have the same code in different places...
If a web user wants to update his/her profile on the site, there would be some validation rules for when a submit button is pushed, like email address cannot be empty, must be valid and must not exist in the database.
These same rules should be applied if I try to update his profile using the internal admin section without having to duplicate the code there...
If you can point me to a good sample project that deals with this would be great!
Thanks in advance!
You should use the MVC pattern with ASP.Net MVC.
The NerdDinner tutorial is a pretty detailed example for MVC, you can also get a book that includes the tutorial (you might want to wait for the version that covers ASP.Net MVC 3). There are plenty of resources on Microsoft's ASP.Net site.
You can always consult Google.
ASP .NET MVC was built with the Model-View-Controller (MVC) pattern in mind. That would be the pattern you'd want to use.
In addition to the resources magnifico provided, I know others have recommended the some other tutorials. I don't know if these have been updated to the latest version of the framework, but they should still serve as decent beginners.
MVC Storefront series
MVC Music Store
Also the Microsoft Patterns & Practices group recently released Project Silk which gets into more advanced techniques involving a lot of AJAX management of the UI. There's interesting stuff there.

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

Have anybody compared ASP.NET MVC to CodeIgniter?

Is there a lot of similarities? I can webforms ASP.NET and some CodeIgniter but haven't much grokked with the asp.net mvc. Have they a lot of similarities?
Other than being frameworks build around MVC there aren't many similarities. (ie they both have folders for Models/Controllers/Views and automatically wire things for you based on naming conventions)
CodeIgniter is the most basic implementation of MVC possible, which allows for incredible flexibility when building your app.
ASP.NET MVC has alot built into it, and is strongly typed. LINQ to SQL provides a built in ORM and the basic MVC templates have frameworks for authentication built in utilizing ASP.NET Membership provider model.
Views in MVC are typed as well, so you have to define the model being passed into the view as opposed to CI which you can pass anything basically.
The helper classes are completely different as well.
ASP.MVC is built upon ASP.NET so alot of things will seem similar with Webforms, but you need to understand MVC pattern. Check out the NerdDinner tutorial for a fantastic introduction to ASP.MVC. (which is a Wrox book which they now make available for free online)
http://www.asp.net/mvc/learn/

How should I implement user membership in my ASP.NET MVC site?

I'm creating an ASP.NET MVC site and I need to implement login and membership functionality.
Is this something where I roll my own? I already have a members table in my database, should I create a username and password hash field and just check against it? What about keeping the user logged in with a cookie that expires?
Is this an instance when you would use ASP.NET's built in Membership service?
ASP.NET MVC neophyte seeks help.
When you create a new ASP.NET MVC site, it already has membership built in. The CodePlex project mentioned in the other reply is only needed in special cases, namely:
You are using an early beta of the MVC framework, which doesn't have the membership feature.
You want to use an authentication system like OpenID, which isn't supported "out-of-the-box" with MVC.
You want membership administration features not included "out-of-the-box"
However, like I said, basic membership functionality is already present in an MVC site. Just add the [Authorize] attribute to any action requiring login. This is regular forms authentication, so you configured in Web.config like a non-MVC site (specifying the database, etc.; there's lots of information on the web about this).
A default MVC site will contain an "Account" controller and views which you can customize to fit your needs.
To answer the obvious question, no, you should not "roll your own." Even if you need custom authentication, it would be better to create a regular ASP.NET membership provider than to create an entirely new membership framework.
Update: The CodePlex project was updated to work with MVC 1.0
If you want to use something safe to start off with, either use the new project's template membership or consider using http://www.codeplex.com/MvcMembership.

Resources