資源簡(jiǎn)介
三層架構(gòu) 增刪改查,只是簡(jiǎn)單的例子,列表顯示,控制器,試圖,類
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Linq;
using?System.Text;
using?Dapper;
using?System.Data;
using?Sem.Model.Entities;
namespace?Sem.DAL.Entities
{
????///?
????///?管理類
????///?此代碼由CsCreator?For?Dapper.Net?于2017/9/24?14:00:14自動(dòng)生成
????///?
????public?partial?class?UserDal
????{
????????///?
????????///??添加新的St_User對(duì)象
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動(dòng)生成
????????///?
????????public?int?AddUser(User?theUser)
????????{
????????????string?sql?=?@“insert?into?St_User(?IDNametitle)
values(@ID@Name@title)“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.Execute(sql?theUser);
????????????}
????????}
????????///?
????????///??查找User對(duì)象是否存在
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動(dòng)生成
????????///?
????????///?查詢參數(shù),進(jìn)行精確匹配查找
????????public?bool?IsExistUser(User?theUser)
????????{
????????????string?sql?=?“select?count(*)?from?St_User?where?ID=@ID?and?Name=@Name?and?title=@title“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.ExecuteScalar(sql?theUser)?>?0???true?:?false;
????????????}
????????}
????????///?
????????///??刪除User對(duì)象
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動(dòng)生成
????????///?
????????///?查詢參數(shù),進(jìn)行精確匹配查找
????????public?int?DelUser(string?ID)
????????{
????????????string?sql?=?@“delete?from?St_User?where?ID=@ID“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.Execute(sql?new?{?ID?});
????????????}
????????}
????????///?
????????///??更新St_User對(duì)象
????????///?
????????public?int?UpdateUser(User?theUser)
????????{
????????????string?sql?=?@“update?St_User?set?Name=@Name?title=@title?where?ID=@ID“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.Execute(sql?theUser);
????????????}
????????}
????????///?
????????///??查找User對(duì)象
????????///?此代碼由?CodeGen?For?Dapper.Net?于?2017/9/24?14:00:14?自動(dòng)生成
????????///?
????????///?查詢參數(shù),進(jìn)行精確匹配查找
????????public?User?GetUser(string?ID)
????????{
????????????string?sql?=?@“select?*?from?St_User?where?ID=@ID“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.QuerySingleOrDefault(sql?new?{?ID?});
????????????}
????????}
????????public?User?GetUser()
????????{
????????????string?sql?=?@“select?top(1)*?from?St_User?order?by?ID?desc“;
????????????using?(IDbConnection?conn?=?ConnectionFactory.getConnection())
????????????{
????????????????return?conn.QuerySingleOrDefault(sql);
????????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????145532??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\Antlr.3.4.1.9004.nupkg
?????文件????????894??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\Antlr.3.4.1.9004.nuspec
?????文件?????102912??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll
?????文件?????431616??2017-09-24?13:40??SemWeb\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.pdb
?????文件?????374152??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\bootstrap.3.3.7.nupkg
?????文件???????1101??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\bootstrap.3.3.7.nuspec
?????文件??????26132??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.css
?????文件??????47706??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.css.map
?????文件??????23409??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.min.css
?????文件??????25648??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap-theme.min.css.map
?????文件?????146010??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.css
?????文件?????389287??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.css.map
?????文件?????121200??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.min.css
?????文件?????542194??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\Content\bootstrap.min.css.map
?????文件??????20127??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.eot
?????文件?????108738??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.svg
?????文件??????45404??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.ttf
?????文件??????23424??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.woff
?????文件??????18028??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\fonts\glyphicons-halflings-regular.woff2
?????文件??????69707??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\sc
?????文件??????37045??2017-09-24?13:40??SemWeb\packages\bootstrap.3.3.7\content\sc
?????文件?????211352??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\Bootstrap.Less.3.3.7.nupkg
?????文件???????1108??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\Bootstrap.Less.3.3.7.nuspec
?????文件???????1518??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\content\Content\bootstrap\alerts.less
?????文件???????1199??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\content\Content\bootstrap\badges.less
?????文件???????1291??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\content\Content\bootstrap\bootstrap.less
?????文件????????594??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\content\Content\bootstrap\breadcrumbs.less
?????文件???????5680??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\content\Content\bootstrap\button-groups.less
?????文件???????3662??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\content\Content\bootstrap\buttons.less
?????文件???????5651??2017-09-24?13:42??SemWeb\packages\Bootstrap.Less.3.3.7\content\Content\bootstrap\carousel.less
............此處省略828個(gè)文件信息
評(píng)論
共有 條評(píng)論