b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

vs2017安装 .NET作品集:linux下的.net mvc cms

电脑杂谈  发布时间:2017-12-24 23:11:45  来源:网络整理

vs2017怎么安装组件_vs2017安装时如何选择_vs2017安装

vs2017安装

.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

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...