IT技術(shu)互動交流平(ping)台

128彩票官网

作者(zhe)︰我叫So  來源(yuan)︰IT165收集  發布日期︰2020-02-20 15:51:26

128彩票官网

這(zhe)是一款(kuan)高(gao)質(zhi)量的.NET C#數據(ju)庫(ku)訪問(wen)框架(ORM)。查詢(xun)接口借鑒 Linq。借助 lambda 表(biao)達式,可以完全用面(mian)向對(dui)象的方(fang)式就能輕松(song)執行多(duo)表(biao)連接查詢(xun)、分組查詢(xun)、聚合(he)查詢(xun)、插(cha)入(ru)數據(ju)、批量刪(shan)除和(he)更新等操作。

其實,早在兩個(ge)月前,Chloe 就已(yi)經支持 Oracle 數據(ju)庫(ku)了,只是LZ個(ge)人平(ping)時用 Oracle 不多(duo),Oracle 較(jiao)其他數據(ju)庫(ku)稍微特(te)別,因此,並沒有及時發布,生怕 bug 連連。經過好(hao)幾(ji)fu)鱸碌某戀恚 酥?Oracle 外,對(dui)框架內部kan)虢 掛滄zuo)了不少的調整(zheng),現在,實體(ti)也支持繼(ji)承父(fu)類或接口,更加可shang)部珊氐氖且倉?至舜媧 蹋 output 參(can)wen)約Oracle 的 RefCurcor 返回結果集。與(yu)此同時,方(fang)便對(dui) Chloe 的感興(xing)趣的同學學習框架,官網也正式上(shang)線了。

128彩票官网

  • Chloe.ORM 事前bai)急查詢(xun)數據(ju) 基本查詢(xun) 連接查詢(xun) 聚合(he)函數 分組查詢(xun) 插(cha)入(ru)數據(ju) 更新數據(ju) 刪(shan)除數據(ju) 存儲過程 支持函數 坎坎坷坷 結語

    128彩票官网

    事前bai)急/h4>

    實體(ti)︰

    public enum Gender{ Man = 1, Woman}[Table('Users')]public class User{ [Sequence('USERS_AUTOID')] public int Id { get; set; } public string Name { get; set; } public Gender? Gender { get; set; } public int? Age { get; set; } public int? CityId { get; set; } public DateTime? OpTime { get; set; }}public class City{ [Column(IsPrimaryKey = true)] public int Id { get; set; } public string Name { get; set; } public int ProvinceId { get; set; }}public class Province{ [Column(IsPrimaryKey = true)] public int Id { get; set; } public string Name { get; set; }}

    因為框架本身需要(yao)與(yu)具(ju)體(ti)的數據(ju)庫(ku)驅(qu)動解耦,所以 OracleContext 構造函數需要(yao)一個(ge) IDbConnectionFactory 的參(can)wen)DbConnectionFactory 接口只有一個(ge) CreateConnection() 方(fang)法,必須(xu)先建個(ge)類,實現 CreateConnection 方(fang)法︰

    public class OracleConnectionFactory : IDbConnectionFactory{ string _connString = null; public OracleConnectionFactory(string connString) { this._connString = connString; } public IDbConnection CreateConnection() { OracleConnection oracleConnection = new OracleConnection(this._connString); OracleConnectionDecorator conn = new OracleConnectionDecorator(oracleConnection); return conn; }}

    由于我用的是 Oracle.ManagedDataAccess 數據(ju)庫(ku)驅(qu)動,OracleConnection 創建的 DbCommand 默認是以順(shun)序(xu)方(fang)式綁定參(can)wen) 裕 shang)述例子使用了裝飾者(zhe)模式對(dui) OracleConnection 封裝了一遍,主要(yao)就是修改 DbCommand 參(can)wen)蠖 fang)式。OracleConnectionDecorator 的定義在官網API文檔和(he) Github 上(shang)的 demo 中都有,在這(zhe)就不貼了,不然太佔ji) /p>

    創建一個(ge) DbContext︰

    string connString = 'Your connection string';OracleContext context = new OracleContext(new OracleConnectionFactory(connString));

    再創建一個(ge) IQuery<T>︰

    IQuery<User> q = context.Query<User>();

    查詢(xun)數據(ju)

    128彩票官网

    IQuery<User> q = context.Query<User>();q.Where(a => a.Id == 1).FirstOrDefault();/* * SELECT 'USERS'.'ID' AS 'ID','USERS'.'NAME' AS 'NAME','USERS'.'GENDER' AS 'GENDER','USERS'.'AGE' AS 'AGE','USERS'.'CITYID' AS 'CITYID','USERS'.'OPTIME' AS 'OPTIME' FROM 'USERS' 'USERS' WHERE ('USERS'.'ID' = 1 AND ROWNUM < 2) *///可以選(xuan)取指定的字段,支持返回匿名類型(xing),也可以返回自(zi)定義類型(xing)q.Where(a => a.Id == 1).Select(a => new { a.Id, a.Name }).FirstOrDefault();/* * SELECT 'USERS'.'ID' AS 'ID','USERS'.'NAME' AS 'NAME' FROM 'USERS' 'USERS' WHERE ('USERS'.'ID' = 1 AND ROWNUM < 2) *///分頁q.Where(a => a.Id > 0).OrderBy(a => a.Age).TakePage(1, 20).ToList();/* * SELECT 'T'.'ID' AS 'ID','T'.'NAME' AS 'NAME','T'.'GENDER' AS 'GENDER','T'.'AGE' AS 'AGE','T'.'CITYID' AS 'CITYID','T'.'OPTIME' AS 'OPTIME' FROM (SELECT 'TTAKE'.'ID' AS 'ID','TTAKE'.'NAME' AS 'NAME','TTAKE'.'GENDER' AS 'GENDER','TTAKE'.'AGE' AS 'AGE','TTAKE'.'CITYID' AS 'CITYID','TTAKE'.'OPTIME' AS 'OPTIME',ROWNUM AS 'ROW_NUMBER_0' FROM (SELECT 'USERS'.'ID' AS 'ID','USERS'.'NAME' AS 'NAME','USERS'.'GENDER' AS 'GENDER','USERS'.'AGE' AS 'AGE','USERS'.'CITYID' AS 'CITYID','USERS'.'OPTIME' AS 'OPTIME' FROM 'USERS' 'USERS' WHERE 'USERS'.'ID' > 0 ORDER BY 'USERS'.'AGE' ASC) 'TTAKE' WHERE ROWNUM < 21) 'T' WHERE 'T'.'ROW_NUMBER_0' > 0 */

    128彩票官网

    IQuery<User> users = context.Query<User>();IQuery<City> cities = context.Query<City>();IQuery<Province> provinces = context.Query<Province>();//建立連接IJoiningQuery<User, City> user_city = users.InnerJoin(cities, (user, city) => user.CityId == city.Id);IJoiningQuery<User, City, Province> user_city_province = user_city.InnerJoin(provinces, (user, city, province) => city.ProvinceId == province.Id);//查出一個(ge)用戶及其隸屬的城市和(he)省份的所有信(xin)息(xi),同樣支持返回匿名類型(xing),也可以返回自(zi)定義類型(xing)var view = user_city_province.Select((user, city, province) => new { User = user, City = city, Province = province }).Where(a => a.User.Id == 1).ToList();/* * SELECT 'USERS'.'ID' AS 'ID','USERS'.'NAME' AS 'NAME','USERS'.'GENDER' AS 'GENDER','USERS'.'AGE' AS 'AGE','USERS'.'CITYID' AS 'CITYID','USERS'.'OPTIME' AS 'OPTIME','CITY'.'ID' AS 'ID0','CITY'.'NAME' AS 'NAME0','CITY'.'PROVINCEID' AS 'PROVINCEID','PROVINCE'.'ID' AS 'ID1','PROVINCE'.'NAME' AS 'NAME1' FROM 'USERS' 'USERS' INNER JOIN 'CITY' 'CITY' ON 'USERS'.'CITYID' = 'CITY'.'ID' INNER JOIN 'PROVINCE' 'PROVINCE' ON 'CITY'.'PROVINCEID' = 'PROVINCE'.'ID' WHERE 'USERS'.'ID' = 1 *///也可以只獲(huo)取指定的字段信(xin)息(xi)︰UserId,UserName,CityName,ProvinceName,這(zhe)時,生成(cheng)的 sql 只包含指定的字段user_city_province.Select((user, city, province) => new { UserId = user.Id, UserName = user.Name, CityName = city.Name, ProvinceName = province.Name }).Where(a => a.UserId == 1).ToList();/* * SELECT 'USERS'.'ID' AS 'USERID','USERS'.'NAME' AS 'USERNAME','CITY'.'NAME' AS 'CITYNAME','PROVINCE'.'NAME' AS 'PROVINCENAME' FROM 'USERS' 'USERS' INNER JOIN 'CITY' 'CITY' ON 'USERS'.'CITYID' = 'CITY'.'ID' INNER JOIN 'PROVINCE' 'PROVINCE' ON 'CITY'.'PROVINCEID' = 'PROVINCE'.'ID' WHERE 'USERS'.'ID' = 1 */

    128彩票官网

    Chloe 的聚合(he)查詢(xun)擁有和(he) linq 差不多(duo)的接口,基本是一看(kan)就明白(bai)。

    IQuery<User> q = context.Query<User>();q.Select(a => AggregateFunctions.Count()).First();/* * SELECT COUNT(1) AS 'C' FROM 'USERS' 'USERS' WHERE ROWNUM < 2 */q.Select(a => new { Count = AggregateFunctions.Count(), LongCount = AggregateFunctions.LongCount(), Sum = AggregateFunctions.Sum(a.Age), Max = AggregateFunctions.Max(a.Age), Min = AggregateFunctions.Min(a.Age), Average = AggregateFunctions.Average(a.Age) }).First();/* * SELECT COUNT(1) AS 'COUNT',COUNT(1) AS 'LONGCOUNT',SUM('USERS'.'AGE') AS 'SUM',MAX('USERS'.'AGE') AS 'MAX',MIN('USERS'.'AGE') AS 'MIN',AVG('USERS'.'AGE') AS 'AVERAGE' FROM 'USERS' 'USERS' WHERE ROWNUM < 2 */var count = q.Count();/* * SELECT COUNT(1) AS 'C' FROM 'USERS' 'USERS' */var longCount = q.LongCount();/* * SELECT COUNT(1) AS 'C' FROM 'USERS' 'USERS' */var sum = q.Sum(a => a.Age);/* * SELECT SUM('USERS'.'AGE') AS 'C' FROM 'USERS' 'USERS' */var max = q.Max(a => a.Age);/* * SELECT MAX('USERS'.'AGE') AS 'C' FROM 'USERS' 'USERS' */var min = q.Min(a => a.Age);/* * SELECT MIN('USERS'.'AGE') AS 'C' FROM 'USERS' 'USERS' */var avg = q.Average(a => a.Age);/* * SELECT AVG('USERS'.'AGE') AS 'C' FROM 'USERS' 'USERS' */

    128彩票官网

    Chloe 的分組查詢(xun)功能,可以像寫(xie) sql 一樣支持 Having 和(he) Select。

    IQuery<User> q = context.Query<User>();IGroupingQuery<User> g = q.Where(a => a.Id > 0).GroupBy(a => a.Age);g = g.Having(a => a.Age > 1 && AggregateFunctions.Count() > 0);g.Select(a => new { a.Age, Count = AggregateFunctions.Count(), Sum = AggregateFunctions.Sum(a.Age), Max = AggregateFunctions.Max(a.Age), Min = AggregateFunctions.Min(a.Age), Avg = AggregateFunctions.Average(a.Age) }).ToList();/* * SELECT 'USERS'.'AGE' AS 'AGE',COUNT(1) AS 'COUNT',SUM('USERS'.'AGE') AS 'SUM',MAX('USERS'.'AGE') AS 'MAX',MIN('USERS'.'AGE') AS 'MIN',AVG('USERS'.'AGE') AS 'AVG' FROM 'USERS' 'USERS' WHERE 'USERS'.'ID' > 0 GROUP BY 'USERS'.'AGE' HAVING ('USERS'.'AGE' > 1 AND COUNT(1) > 0) */

    插(cha)入(ru)數據(ju)

    128彩票官网

    以 lambda 表(biao)達式樹的方(fang)式插(cha)入(ru)︰

    此種方(fang)式插(cha)入(ru)的好(hao)處是,可以指定列(lie)插(cha)入(ru),就像寫(xie) sql 一樣簡單。
    同時,該方(fang)式插(cha)入(ru)返回表(biao)主鍵值。如果實體(ti)主鍵是自(zi)增列(lie)(序(xu)列(lie)),返回值就會是自(zi)增值。

    /* User 實體(ti)打了序(xu)列(lie)標簽,會自(zi)動獲(huo)取序(xu)列(lie)值。返回主鍵 Id */int id = (int)context.Insert<User>(() => new User() { Name = 'lu', Age = 18, Gender = Gender.Man, CityId = 1, OpTime = DateTime.Now });/* * SELECT 'USERS_AUTOID'.'NEXTVAL' FROM 'DUAL' * Int32 :P_0 = 14; INSERT INTO 'USERS'('NAME','AGE','GENDER','CITYID','OPTIME','ID') VALUES(N'lu',18,1,1,SYSTIMESTAMP,:P_0) */

    128彩票官网

    以實體(ti)的方(fang)式插(cha)入(ru)︰

    該方(fang)式插(cha)入(ru),如果一個(ge)實體(ti)存在自(zi)增列(lie),會自(zi)動將自(zi)增列(lie)設置到jiao)嚶Φ氖糶隕shang)。

    User user = new User();user.Name = 'lu';user.Age = 18;user.Gender = Gender.Man;user.CityId = 1;user.OpTime = DateTime.Now;//會自(zi)動將自(zi)增 Id 設置到 user 的 Id 屬性上(shang)user = context.Insert(user);/* * SELECT 'USERS_AUTOID'.'NEXTVAL' FROM 'DUAL' * Int32 :P_0 = 15; String :P_1 = 'lu'; Int32 :P_2 = 1; Int32 :P_3 = 18; DateTime :P_4 = '2016/9/5 9:16:59'; INSERT INTO 'USERS'('ID','NAME','GENDER','AGE','CITYID','OPTIME') VALUES(:P_0,:P_1,:P_2,:P_3,:P_2,:P_4) */

    更新數據(ju)

    128彩票官网

    以 lambda 表(biao)達式樹的方(fang)式更新︰

    該方(fang)式解決的問(wen)題(ti)是︰1.指定列(lie)更新;2.批量更新;3.支持類似 Age=Age + 100 這(zhe)樣更新字段。

    context.Update<User>(a => a.Id == 1, a => new User() { Name = a.Name, Age = a.Age + 100, Gender = Gender.Man, OpTime = DateTime.Now });/* * UPDATE 'USERS' SET 'NAME'='USERS'.'NAME','AGE'=('USERS'.'AGE' + 100),'GENDER'=1,'OPTIME'=SYSTIMESTAMP WHERE 'USERS'.'ID' = 1 *///批量更新//給(gei)所有xin) 閱昵10 歲(sui)context.Update<User>(a => a.Gender == Gender.Woman, a => new User() { Age = a.Age - 10, OpTime = DateTime.Now });/* * UPDATE 'USERS' SET 'AGE'=('USERS'.'AGE' - 10),'OPTIME'=SYSTIMESTAMP WHERE 'USERS'.'GENDER' = 2 */

    128彩票官网

    以實體(ti)的方(fang)式更新︰

    User user = new User();user.Id = 1;user.Name = 'lu';user.Age = 28;user.Gender = Gender.Man;user.OpTime = DateTime.Now;context.Update(user); //會更新所有映cheng)淶淖佷* * String :P_0 = 'lu'; Int32 :P_1 = 1; Int32 :P_2 = 28; Nullable<Int32> :P_3 = NULL; DateTime :P_4 = '2016/9/5 9:20:07'; UPDATE 'USERS' SET 'NAME'=:P_0,'GENDER'=:P_1,'AGE'=:P_2,'CITYID'=:P_3,'OPTIME'=:P_4 WHERE 'USERS'.'ID' = :P_1 *//* * 支持只更新屬性值已(yi)變的屬性 */context.TrackEntity(user);//在上(shang)下文中跟蹤實體(ti)user.Name = user.Name + '1';context.Update(user);//這(zhe)時只會更新被修改的字段/* * String :P_0 = 'lu1'; Int32 :P_1 = 1; UPDATE 'USERS' SET 'NAME'=:P_0 WHERE 'USERS'.'ID' = :P_1 */

    刪(shan)除數據(ju)

    128彩票官网

    以 lambda 表(biao)達式樹的方(fang)式刪(shan)除︰

    context.Delete<User>(a => a.Id == 1);/* * DELETE FROM 'USERS' WHERE 'USERS'.'ID' = 1 *///批量刪(shan)除//刪(shan)除所有不男不女的用戶context.Delete<User>(a => a.Gender == null);/* * DELETE FROM 'USERS' WHERE 'USERS'.'GENDER' IS NULL */

    128彩票官网

    以實體(ti)的方(fang)式刪(shan)除︰

    User user = new User();user.Id = 1;context.Delete(user);/* * Int32 :P_0 = 1; DELETE FROM 'USERS' WHERE 'USERS'.'ID' = :P_0 */

    存儲過程

    通(tong)過存儲過程獲(huo)取一個(ge) User 信(xin)息(xi)︰

    Oracle 數據(ju)庫(ku)中,如果一個(ge)存儲過程需要(yao)返回結果集,需要(yao)借助 RefCursor output 參(can)wen)te)性。用法如下︰

    /* 必須(xu)先自(zi)定義 RefCursor 參(can)wen)*/OracleParameter p_cur = new OracleParameter();p_cur.ParameterName = 'p_cur';p_cur.OracleDbType = OracleDbType.RefCursor;p_cur.Direction = ParameterDirection.Output;DbParam refCursorParam = new DbParam();/* 將自(zi)定義 RefCursor 參(can)wen)柚玫DbParam 的 ExplicitParameter 屬性 */refCursorParam.ExplicitParameter = p_cur;DbParam id = new DbParam('id', 1);User user = context.SqlQuery<User>('Proc_GetUser', CommandType.StoredProcedure, id,refCursorParam).FirstOrDefault();

    通(tong)過存儲過程的 output 參(can)wen)huo)取一個(ge)用戶的 name︰

    DbParam id = new DbParam('id', 1);DbParam outputName = new DbParam('name', null, typeof(string)) { Direction = ParamDirection.Output };context.Session.ExecuteNonQuery('Proc_GetUserName', CommandType.StoredProcedure, id, outputName);

    支持函數

    IQuery<User> q = context.Query<User>();var space = new char[] { ' ' };DateTime startTime = DateTime.Now;DateTime endTime = startTime.AddDays(1);var ret = q.Select(a => new {  Id = a.Id,  String_Length = (int?)a.Name.Length,//LENGTH('USERS'.'NAME')  Substring = a.Name.Substring(0),//SUBSTR('USERS'.'NAME',0 + 1,LENGTH('USERS'.'NAME'))  Substring1 = a.Name.Substring(1),//SUBSTR('USERS'.'NAME',1 + 1,LENGTH('USERS'.'NAME'))  Substring1_2 = a.Name.Substring(1, 2),//SUBSTR('USERS'.'NAME',1 + 1,2)  ToLower = a.Name.ToLower(),//LOWER('USERS'.'NAME')  ToUpper = a.Name.ToUpper(),//UPPER('USERS'.'NAME')  IsNullOrEmpty = string.IsNullOrEmpty(a.Name),//too long  Contains = (bool?)a.Name.Contains('s'),//  Trim = a.Name.Trim(),//TRIM('USERS'.'NAME')  TrimStart = a.Name.TrimStart(space),//LTRIM('USERS'.'NAME')  TrimEnd = a.Name.TrimEnd(space),//RTRIM('USERS'.'NAME')  StartsWith = (bool?)a.Name.StartsWith('s'),//  EndsWith = (bool?)a.Name.EndsWith('s'),//  /* oracle is not supported DbFunctions.Diffxx. */  //DiffYears = DbFunctions.DiffYears(startTime, endTime),//  //DiffMonths = DbFunctions.DiffMonths(startTime, endTime),//  //DiffDays = DbFunctions.DiffDays(startTime, endTime),//  //DiffHours = DbFunctions.DiffHours(startTime, endTime),//  //DiffMinutes = DbFunctions.DiffMinutes(startTime, endTime),//  //DiffSeconds = DbFunctions.DiffSeconds(startTime, endTime),//  //DiffMilliseconds = DbFunctions.DiffMilliseconds(startTime, endTime),//  //DiffMicroseconds = DbFunctions.DiffMicroseconds(startTime, endTime),//  /* ((CAST(:P_0 AS DATE)-CAST(:P_1 AS DATE)) * 86400000 + CAST(TO_CHAR(CAST(:P_0 AS TIMESTAMP),'ff3') AS NUMBER) - CAST(TO_CHAR(CAST(:P_1 AS TIMESTAMP),'ff3') AS NUMBER)) / 86400000 */  SubtractTotalDays = endTime.Subtract(startTime).TotalDays,//  SubtractTotalHours = endTime.Subtract(startTime).TotalHours,//...  SubtractTotalMinutes = endTime.Subtract(startTime).TotalMinutes,//...  SubtractTotalSeconds = endTime.Subtract(startTime).TotalSeconds,//...  SubtractTotalMilliseconds = endTime.Subtract(startTime).TotalMilliseconds,//...  AddYears = startTime.AddYears(1),//ADD_MONTHS(:P_0,12 * 1)  AddMonths = startTime.AddMonths(1),//ADD_MONTHS(:P_0,1)  AddDays = startTime.AddDays(1),//(:P_0 + 1)  AddHours = startTime.AddHours(1),//(:P_0 + NUMTODSINTERVAL(1,'HOUR'))  AddMinutes = startTime.AddMinutes(2),//(:P_0 + NUMTODSINTERVAL(2,'MINUTE'))  AddSeconds = startTime.AddSeconds(120),//(:P_0 + NUMTODSINTERVAL(120,'SECOND'))  //AddMilliseconds = startTime.AddMilliseconds(20000),//不hui)? Now = DateTime.Now,//SYSTIMESTAMP  UtcNow = DateTime.UtcNow,//SYS_EXTRACT_UTC(SYSTIMESTAMP)  Today = DateTime.Today,//TRUNC(SYSDATE,'DD')  Date = DateTime.Now.Date,//TRUNC(SYSTIMESTAMP,'DD')  Year = DateTime.Now.Year,//CAST(TO_CHAR(SYSTIMESTAMP,'yyyy') AS NUMBER)  Month = DateTime.Now.Month,//CAST(TO_CHAR(SYSTIMESTAMP,'mm') AS NUMBER)  Day = DateTime.Now.Day,//CAST(TO_CHAR(SYSTIMESTAMP,'dd') AS NUMBER)  Hour = DateTime.Now.Hour,//CAST(TO_CHAR(SYSTIMESTAMP,'hh44') AS NUMBER)  Minute = DateTime.Now.Minute,//CAST(TO_CHAR(SYSTIMESTAMP,'mi') AS NUMBER)  Second = DateTime.Now.Second,//CAST(TO_CHAR(SYSTIMESTAMP,'ss') AS NUMBER)  Millisecond = DateTime.Now.Millisecond,//CAST(TO_CHAR(SYSTIMESTAMP,'ff3') AS NUMBER)  DayOfWeek = DateTime.Now.DayOfWeek,//(CAST(TO_CHAR(SYSTIMESTAMP,'D') AS NUMBER) - 1)  Int_Parse = int.Parse('1'),//CAST(N'1' AS NUMBER)  Int16_Parse = Int16.Parse('11'),//CAST(N'11' AS NUMBER)  Long_Parse = long.Parse('2'),//CAST(N'2' AS NUMBER)  Double_Parse = double.Parse('3'),//CAST(N'3' AS BINARY_DOUBLE)  Float_Parse = float.Parse('4'),//CAST(N'4' AS BINARY_FLOAT)  Decimal_Parse = decimal.Parse('5'),//CAST(N'5' AS NUMBER)  //Guid_Parse = Guid.Parse('D544BC4C-739E-4CD3-A3D3-7BF803FCE179'),//不hui)? Bool_Parse = bool.Parse('1'),//  DateTime_Parse = DateTime.Parse('2020-02-20'),//TO_TIMESTAMP(N'2020-02-20','yyyy-mm-dd hh44:mi:ssxff')  B = a.Age == null ? false : a.Age > 1, }).ToList();

    128彩票官网

    支持 Oracle,一開始我是拒(畏)絕(jue)(懼)的,這(zhe)貨太奇葩了- -。後來想(xiang)想(xiang),反正遲早都得要(yao)支持,干脆把它給(gei)干了吧,免得“夜長夢多(duo)”!不過 Oracle 是真奇葩,煩(fan)chang)”bi)如,Oracle 不能直接在存儲過程里直接執行 Select sql 返回結果集,必須(xu)得依賴(lai)它那個(ge)神(shen)馬(ma) RefCurcor 參(can)wen) zhe)個(ge)我真的萬(wan)萬(wan)沒想(xiang)到,後來一位園友(you)提醒(xing)了才留意(yi)這(zhe)個(ge)特(te)性! 再一個(ge),Oracle 不hui)?bool 類型(xing),Oracle.ManagedDataAccess 這(zhe)個(ge)驅(qu)動的 DataReader 也不hui)?GetBoolean 方(fang)法,同時 Oracle.ManagedDataAccess 創建的 DbCommand 默認是是以順(shun)序(xu)方(fang)式綁定參(can)wen) 虼耍 植壞貌歡dui) DataReader 和(he) DbCommand 包裝一遍才能用。如果真的要(yao)細數起來,Oracle 的糟(zao)點(dian)連起來估(gu)計(ji)能繞地球一圈!

    128彩票官网

    把 Oracle 給(gei)支持了,心中的石頭也終于落下,生活(huo)輕松(song)了許多(duo)。作為眾多(duo) ORM 中為數不多(duo)能支持 Oracle 的一枚成(cheng)員(yuan),感興(xing)趣的mu)梢怨刈 徊 ;蛐恚hloe 真能給(gei)你帶(dai)來不一樣的感覺!更多(duo)詳(xiang)細用法敬請參(can)照官網API文檔。

    技術(shu)教程或心得我倒不是很擅長寫(xie),我只想(xiang)把日常(chang)開發的一些干貨分享給(gei)大家,您的推(tui)薦是我分享的最大動力。如果覺得 Chloe 這(zhe)個(ge)開源(yuan)項(xiang)目(mu)不錯,望大家給(gei)個(ge)贊,也可以上(shang) Github 關注或收藏(star)一下,以yuan)隳薌笆筆盞礁巒tong)知。同時,Chloe 官網以及基于 NFine 改造的後台後續也會放出,有期待的同學可以點(dian)個(ge)關注,也歡迎廣大C#同胞入(ru)群交流,暢(chang)談.NET復興(xing)大計(ji)。最後,感謝大家閱讀至此!

    Chloe.ORM 完全開源(yuan),遵循 Apache2.0 協議,托管于 GitHub,地址︰https://github.com/shuxinqin/Chloe。

    官網︰http://www.52chloe.com
    官網後台︰http://www.52chloe.com:82

Tag標簽︰高(gao)品質(zhi)  過程  工具(ju)  
  • 128彩票官网

About IT165 - 廣告服務 - 隱私聲(sheng)明 - 版權申明 - 免責(ze)條款(kuan) - 網站地圖 - 網友(you)投(tou)稿(gao) - 聯系方(fang)式
本站內容來自(zi)于互聯網,僅(jin)供用于網絡(luo)技術(shu)學習,學習中請遵循相關法律法規(gui)
128彩票官网 | 下一页