“我記錄”開發(fā)框架(wojilu framework) 是 .net 平臺(tái)下的綜合開發(fā)框架,主要用于 web 方面的快速開發(fā)。
官方網(wǎng)址:http://www.wojilu.com
源碼托管網(wǎng)址: https://github.com/wojilu/wojilu
授權(quán)協(xié)議:Apache License,可免費(fèi)用于商業(yè)環(huán)境
~/{controller}/{id};requirements:{id=int}默認(rèn)Controller的Show(int id)方法,此處id直接傳入
public void Show(int id) { }
public void Show(int id) { set("siteleft", qjw.Web.siteleft()); using (MAction action = new MAction(TableNames.zt_article)) { int page = ctx.route.page; int rowcount = 0; int pagesize = 10; MDataTable table = action.Select(page, pagesize, "IsDel=0 and classid="+ id +" order by posttime desc", out rowcount); //MDataTable table = action.Select("IsDel=0 order by posttime desc"); IBlock block = getBlock("Article"); foreach (MDataRow row in table.Rows) { block.Set("article.id", row["id"]); block.Set("article.title", row["title"]); block.Next(); } //生成分頁條 int recordCount = rowcount; int pageSize = pagesize; int currentPage = ctx.route.page; wojilu.PageHelper op = new wojilu.PageHelper(recordCount, pageSize, currentPage); set("page", op.PageBar); } }
CyqData數(shù)據(jù)
單條記錄操作
using (MAction action = new MAction(TableNames.zt_class)) { if (action.Fill(id)) { set("ztclass.id", action.Get<string>(zt_class.ID)); set("ztclass.classname", action.Get<string>(zt_class.ClassName)); set("ztclass.content", action.Get<string>(zt_class.Content)); } }
多條記錄操作
using (MAction action = new MAction(TableNames.zt_class)) { MDataTable table = action.Select("IsDel=0 and FatherId=0 and IsNav=1 and SystemId=1 and id>1 order by orderflag asc "); IBlock cblock = getBlock("Nav"); foreach (MDataRow row in table.Rows) { cblock.Set("ztclass.id", row["id"]); cblock.Set("ztclass.classname", row["classname"]); cblock.Set("ztclass.url", row["url"]); cblock.Next(); } }
變量使用后就會(huì)釋放,變量名可以重復(fù)
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注