日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SubSonic学习(一)

發(fā)布時間:2023/12/31 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SubSonic学习(一) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
?????月圓之夜,窗外炮竹聲不絕于耳,今晚,幸福屬于我們每個人!

??????忽然想起一句和元宵佳節(jié)有關(guān)的詩“眾里尋他千百度,驀然回首,那人卻在燈火闌珊處”。詩中的哲理蘊含在日常生活的每一個角落。

?????畢業(yè)剛半年,接觸SubSonic時間也不長,所以只想把自己的學(xué)習(xí)筆記整理下,望能拋磚引玉了(參考http://subsonicproject.com/)

?????SubSonic: Version 2.1 (Pakala)?????

?????a.Create a query tool where you would be able to do 95% of all the queries you’d need, in a readable, discoverable way?

?????b.Work up your DAL, not complicated and time-consuming.

????? c.Very?very?close to SQL?

?

1.Web.config

?????

//創(chuàng)建一個自動生成類的buildProvider

//.abp文件中指明將哪些數(shù)據(jù)庫表自動生成類,表名按行列出;所有都生成時,輸入*

?

2.Load an object

a)??????FetchByID

//SubSonic will not work with tables that do not have a primary key

Product product = Product.FetchByID(id);??

if (product.ProductID == id)

{ // Success } else { // Not Found }

//If the object is not found, SubSonic will not throw an error.

b)???????the overloaded constructor

Product product = new Product(xxxxxxxxxxxxxxxxxx);

c)???? NewFromXML

Session["Product"] = product.ToXML();

product=(Product)product.NewFromXML(Session["Product"].ToString());

?

2.??? Retrieving Multiple Objects

a)???? FetchAll()

b)??? FetchByParameter()

c)???? FetchByQuery(query)

d)??? Product product = new Product();

??????????product.SupplierID = 1;

??????????product.CategoryID = 1;

??????????GridView1.DataSource = Product.Find(product);??? //基于已存在的對象查找結(jié)果

e)???? Query

?

3.??? Queries

a)???? SubSonic.Query query = Product.CreateQuery();

??????????SubSonic.Query query = new SubSonic.Query(xxxxxxxxxxxx);

??????????query.OrderBy =SubSonic.OrderBy.Asc(xxxxxxx);

??????????//there is no way to order by multiple columns.

b)??? query.SelectList = Product.Columns.ProductName + ", " + Product.Columns.SupplierID;

??????????//顯示指定的字段

c)???? query.addwhere()

?

4.??? Stored Procedures&&Commands

a)???? SubSonic.StoredProcedure sp = SPs.CustOrderHist(customerID);

??????????//The stored procedure can then either call Execute, ExecuteScalar, GetDataSet or GetReader to execute and return the data.

b)??? string sql = query.GetSql();

??????????SubSonic.QueryCommand cmd = product.GetInsertCommand(xxxxxx);

??????????//If the querying power of SubSonic falls short for your needs, you can still use the existing functionality and extend it by accessing the commands that are being built before execution.

?以上只是SubSonic很籠統(tǒng)很淺顯的介紹,下篇我想舉些例子來運用下以上的方法,元宵節(jié)快樂!

?

?

轉(zhuǎn)載于:https://www.cnblogs.com/yuxhust/archive/2009/02/09/1387065.html

總結(jié)

以上是生活随笔為你收集整理的SubSonic学习(一)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。