学习MVC两个来月了,终于决定最个能让自己满意的MVC.于是,在cnblog的洞庭夕照大大的MVC5网站开发实践的帮助下,开始了MVC之路
再次感谢洞庭夕照大大,框架就直接按洞庭夕照大大的来了..
项目名字就叫FantasyCMS好了.取自FINAL FANTASY游戏
首先创建项目
直接选MVC,不创建EMPTY是方便添加一些必要的引用.
添加类库
BLL,IBLL,IDAL,DAL不解释,参考洞庭夕照大大的博客.
反正要做,干脆把controllers也分离出来,extensions放一些扩展,比如bundle,淘宝接口等.
添加引用:
Web:
IDAL:FantasyCMS.Model
IBLL:FantasyCMS.Model
DAL:
Controllers
BLL:
Extensions:
删除Fantasy.CMS.Web内的Models,Controllers等文件夹,仅保留以下
同时把App_Start下的BundleConfig,FilterConfig,RouteConfig复制到Extensions内
同时修改这3个文件的namespace FantasyCMS.Extensions
修改Global.asax
using System;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using FantasyCMS.Extensions;
namespace FantasyCMS.Web
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
OK,这样FantasyCMS就初步完成了..
DAL,BLL的内容请参考洞庭夕照大大的博客
再次感谢洞庭夕照大大