
.net framework 4.0
sqlite
mono linux 运行环境以及mono下的sqlite库
razor 模板引擎
dapper 轻量级orm框架
vs2017 社区版本
这次的开发工具比较新了吧,上次用vs2010发的,跨度比较大,这个项目之前也是在10下开发出来的,虽然用2017,其实没什么影响的。
razor引擎比nvelocity的易用性高很多,而且跟后端集合的比较好。
而且这次的项目完全使用dapper orm,整个访问层操作看起来也清爽很多了。

左侧主要分为三个文件夹,Jqpress.web是存放web路由入口、模板皮肤、静态文件,上传文件夹,后台管理程序通过Areas域管理来实现的,整个项目结构还是比较清晰的。

如下为一个列表界面的Action逻辑才20几行
public ActionResult Category(string pagename)
{
var model = new PostListModel();
CategoryInfo cate = _categoryService.GetCategory(pagename);
model.Category = cate;
if (cate != null)
{
int categoryId = cate.CategoryId;
model.MetaKeywords = cate.CateName;
model.MetaDescription = cate.Description;
ViewBag.Title = cate.CateName;
model.Url = ConfigHelper.SiteUrl + "category/" + Jqpress.Framework.Utils.StringHelper.SqlEncode(pagename) + "/page/{0}";
const int pageSize = 10;
int count = 0;
int pageIndex = PressRequest.GetInt("page", 1);
int cateid = PressRequest.GetQueryInt("cateid", -1);
int tagid = PressRequest.GetQueryInt("tagid", -1);
if (cateid > 0)
pageIndex = pageIndex + 1;
var cateids =categoryId+","+ _categoryService.GetCategoryList().FindAll(c => c.ParentId == categoryId).Aggregate(string.Empty, (current, t) => current + (t.CategoryId + ",")).TrimEnd(',');
var postlist = _postService.GetPostPageList(pageSize, pageIndex, out count, cateids.TrimEnd(','), tagid, -1, -1, -1, -1, -1,-1, "", "", "");
model.PageList.LoadPagedList(postlist);
model.PostList = (List<PostInfo>)postlist;
}
model.IsDefault = 0;
return View(model.Category.ViewName,model);
}
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-55640-1.html
呵呵
再说了