Musicstore
MVC music store is based on the best ASP. netmvc getting started tutorial that guides you how to use MVC and Visual Studio for web development. The latest version of MVC music store is developed based on ASP. net mvc 3 using Visual Studio 2010.
Mvcquick. Framework
Mvcquick. An original open-source framework for rapid development of ASP. net mvc applications. Mvcquick. framework includes a repository, an IOC container, a log manager, and a security provider.
Object definition:
public class Album : EntityBase
{
public string Title { get; set; }
public decimal Price { get; set; }
public string AlbumArtUrl { get; set; }
public Genre Genre { get; set; }
public Artist Artist { get; set; }
public IEnumerable<OrderDetail> OrderDetails { get; set; }
}
Storage:
// Global configuration
Nhibernatemanager. configuration ();
Nhibernatemanager. addmapping ("mvcquick ",
Typeof (entitybase). assembly,
Typeof (album). Assembly );
Nhibernatemanager. updateschema ();
Classiccontainer. register <nhibernaterepository> ("nhibernaterepository ");
// Use
Repository. Save <cart> (cartitem );
VaR cartitems =
Repository. query <cart> ()
. Where (x => X. guid = shoppingcartid)
. Tolist ();
IOC container:
ClassicContainer.Register<AccountController>("Account", properties);
Logs:
// Global configuration
Logger. configurelog4net (httpcontext. Current. server. mappath ("~ /Log "), loglevel. info, loglevel. info );
// Use
Logger logger = logger. getlogger (filtercontext. Controller. GetType ());
Logger. Error (filtercontext. Exception );
Member provider:
<membership defaultProvider="ClassicMembershipProvider">
<providers>
<clear/>
<add name="ClassicMembershipProvider" type="MVCQuick.Framework.Security.ClassicMembershipProvider"
enablePasswordRetrieval="false" enablePasswordReset="false" requiresUniqueEmail="false"
requiresQuestionAndAnswer="false" minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0" applicationName="MVCQuick" passwordFormat="Hashed" />
</providers>
</membership>
Reconstruction
1. Model
Modify the object class to inherit from mvcquick. Framework. entitybase
Use mvcquick. Framework. repository to replace Entity Framework
2. Controller
Use mvcquick. Framework. container to decouple the controller from the Data Access Object
3. View
Unchanged, modify some fields
4. Configuration
Replace the default member provider and role provider with mvcquick. Framework. Security. classicmembershipprovider and mvcquick. Framework. Security. classicroleprovider.
Added the log function.
5. Test
Test Running Effect
Source code download: http://mvcquick.codeplex.com/