av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

自己寫(xiě)數(shù)據(jù)庫(kù)訪問(wèn)ORM

 下面看一個(gè)例子:

成都創(chuàng)新互聯(lián)專(zhuān)注為客戶(hù)提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)、東源網(wǎng)絡(luò)推廣、成都小程序開(kāi)發(fā)、東源網(wǎng)絡(luò)營(yíng)銷(xiāo)、東源企業(yè)策劃、東源品牌公關(guān)、搜索引擎seo、人物專(zhuān)訪、企業(yè)宣傳片、企業(yè)代運(yùn)營(yíng)等,從售前售中售后,我們都將竭誠(chéng)為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);成都創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供東源建站搭建服務(wù),24小時(shí)服務(wù)熱線:18980820575,官方網(wǎng)址:www.cdcxhl.com

現(xiàn)在有一個(gè)用戶(hù)信息的表:E-R圖如下:

要實(shí)現(xiàn)該表的數(shù)據(jù)庫(kù)新增、修改、查詢(xún)功能,需要實(shí)現(xiàn)下面兩個(gè)業(yè)務(wù)類(lèi):

 
 
 
 
  1. using Csla; 
  2. using IF.CslaCore; 
  3. using IF.OrmCore.DataSchema; 
  4. using System; 
  5. using System.Collections.Generic; 
  6. using System.ComponentModel; 
  7. using System.Linq; 
  8. using System.Text; 
  9. using System.Threading.Tasks; 
  10.  
  11. namespace IF.SysUser.Business 
  12.     [Serializable] 
  13.     [TableClass(FriendlyName="用戶(hù)信息表",TableName="SYS_USER")] 
  14.     public class SysUser : IfBusiness 
  15.     { 
  16.         private static readonly PropertyInfo SUR_IDProperty = RegisterProperty(c => c.SUR_ID); 
  17.  
  18.         [DisplayName("SUR_ID")] 
  19.         [FieldDescription(IsPrimaryKey=true,ColumnName="SUR_ID",FriendlyName="SUR_ID",NeedUpdate=true)] 
  20.         public string SUR_ID { get; set; } 
  21.  
  22.         private static readonly PropertyInfo UserNameProperty = RegisterProperty(c => c.UserName); 
  23.         [DisplayName("登錄名")] 
  24.         [FieldDescription(ColumnName="SUR_USERNAME",FriendlyName="登錄名",NeedUpdate=true)] 
  25.         public string UserName { get; set; } 
  26.  
  27.  
  28.         private static readonly PropertyInfo NameProperty = RegisterProperty(c => c.Name); 
  29.         [DisplayName("姓名")] 
  30.         [FieldDescription(ColumnName="SUR_NAME",FriendlyName="姓名",NeedUpdate=true)] 
  31.         public string Name { get; set; } 
  32.  
  33.         private static readonly PropertyInfo PasswordProperty = RegisterProperty(c => c.Password); 
  34.         [DisplayName("密碼")] 
  35.         [FieldDescription(ColumnName="SUR_PASSWORD",FriendlyName="密碼",NeedUpdate=true)] 
  36.         public string Password { get; set; } 
  37.  
  38.         private static readonly PropertyInfo LoginMacProperty = RegisterProperty(c => c.LoginMac); 
  39.         [DisplayName("登錄Mac地址")] 
  40.         [FieldDescription(ColumnName="SUR_LOGIN_MAC",FriendlyName="登錄Mac地址",NeedUpdate=true)] 
  41.         public string LoginMac { get; set; } 
  42.  
  43.         private static readonly PropertyInfo LoginIPProperty = RegisterProperty(c => c.LoginIP); 
  44.         [DisplayName("登錄IP")] 
  45.         [FieldDescription(ColumnName="SUR_LOGIN_IP",FriendlyName="登錄IP",NeedUpdate=true)] 
  46.         public string LoginIP { get; set; } 
  47.  
  48.  
  49.         private static readonly PropertyInfo LoginTimeProperty = RegisterProperty(c => c.LoginTime); 
  50.         [DisplayName("登錄時(shí)間")] 
  51.         [FieldDescription(ColumnName="SUR_LOGIN_TIME",FriendlyName="登錄時(shí)間",NeedUpdate=true)] 
  52.         public DateTime? LoginTime { get; set; } 
  53.  
  54.         private static readonly PropertyInfo LogoutTimeProperty = RegisterProperty(c => c.LogoutTime); 
  55.         [DisplayName("登出時(shí)間")] 
  56.         [FieldDescription(ColumnName="SUR_LOGOUT_TIME",FriendlyName="登出時(shí)間",NeedUpdate=true)] 
  57.         public DateTime? LogoutTime { get; set; } 
  58.  
  59.         private static readonly PropertyInfo LoginFailTimeProperty = RegisterProperty(c => c.LoginFailTime); 
  60.         [DisplayName("登錄失敗時(shí)間")] 
  61.         [FieldDescription(ColumnName="SUR_LOGIN_FAIL_TIME",FriendlyName="登錄失敗時(shí)間",NeedUpdate=true)] 
  62.         public DateTime? LoginFailTime { get; set; } 
  63.  
  64.         private static readonly PropertyInfo LoginFailCountProperty = RegisterProperty(c => c.LoginFailCount); 
  65.         [DisplayName("登錄失敗次數(shù)")] 
  66.         [FieldDescription(ColumnName="SUR_LOGIN_FAIL_COUNT",FriendlyName="登錄失敗次數(shù)",NeedUpdate=true)] 
  67.         public Int32? LoginFailCount { get; set; } 
  68.  
  69.  
  70.         private static readonly PropertyInfo LockFGProperty = RegisterProperty(c => c.LockFG); 
  71.         [DisplayName("是否鎖定")] 
  72.         [FieldDescription(ColumnName="SUR_LOCK_FG",FriendlyName="是否鎖定",NeedUpdate=true)] 
  73.         public bool? LockFG { get; set; } 
  74.  
  75.         private static readonly PropertyInfo DisableFGProperty = RegisterProperty(c => c.DisableFG); 
  76.         [DisplayName("是否有效")] 
  77.         [FieldDescription(ColumnName="SUR_DISABLE_FG",FriendlyName="是否有效",NeedUpdate=true)] 
  78.         public bool? DisableFG { get; set; } 
  79.  
  80.  
  81.         #region 通用字段 
  82.  
  83.         private static readonly PropertyInfo CreateTimeProperty = RegisterProperty(c => c.CreateTime); 
  84.         [DisplayName("創(chuàng)建時(shí)間")] 
  85.         [FieldDescription(ColumnName="CreateTime",FriendlyName="創(chuàng)建時(shí)間",NeedUpdate=true)] 
  86.         public override DateTime? CreateTime { get; set; } 
  87.  
  88.         private static readonly PropertyInfo LastUpdateTimeProperty = RegisterProperty(c => c.LastUpdateTime); 
  89.         [DisplayName("***修改時(shí)間")] 
  90.         [FieldDescription(ColumnName="LastUpdateTime",FriendlyName="***修改時(shí)間",NeedUpdate=true)] 
  91.         public override DateTime? LastUpdateTime { get; set; } 
  92.  
  93.  
  94.  
  95.         public override void SetPrimaryKey(string key) 
  96.         { 
  97.             SUR_ID = key; 
  98.         } 
  99.         #endregion 
  100.     } 
  101.  
  102.     [Serializable] 
  103.     public class SysUserList : IfBusinessList 
  104.     { } 

現(xiàn)在就可以工作了:

全表檢索數(shù)據(jù)方法:

 
 
 
 
  1. SysUserList selData = SysUserList.Fetch(); 

向數(shù)據(jù)庫(kù)新增一條數(shù)據(jù):

 
 
 
 
  1. SysUser.Business.SysUser user = new SysUser.Business.SysUser(); 
  2. user.UserName= "inaction"; 
  3. user.Name = "流砂"; 
  4. user.Password= "superman"; 
  5. selData.Add(user); 
  6. selData.Save(); 

向數(shù)據(jù)庫(kù)修改數(shù)據(jù):

 
 
 
 
  1. var user = SysUserList.Fetch(c => c.UserName == "inaction"); 
  2. user.Password = "123456"; 
  3.  SysUserList list = new SysUserList { user }; 
  4.  list.Save(); 

以上代碼就實(shí)現(xiàn)了對(duì)密碼的修改。

特別說(shuō)明:目前IF 只能通過(guò)SysUserList對(duì)象的Save方法保存數(shù)據(jù)。以后會(huì)實(shí)現(xiàn)通過(guò)業(yè)務(wù)類(lèi)自身Save方法保存數(shù)據(jù)。


網(wǎng)頁(yè)標(biāo)題:自己寫(xiě)數(shù)據(jù)庫(kù)訪問(wèn)ORM
鏈接URL:http://uogjgqi.cn/article/cdjdhpo.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問(wèn)/技術(shù)咨詢(xún)/運(yùn)營(yíng)咨詢(xún)/技術(shù)建議/互聯(lián)網(wǎng)交流