subsonic

SubSonic学习(二)

怎甘沉沦 提交于 2019-11-27 22:50:13
SubSonic作为一种OR Mapper,可以用极少的代码完成对DAL的操作。下面我们比较下分别用SubSonic和ADO.NET两种方法的操作。 以Northwind数据库为例子,我们要实现根据ProductID进行查找并用gridview将操作结果显示出来,如图 // ADO.NET ADO.NET中若要进行其他操作,则只需更改SQL语句就OK了……,可以看出代码的冗余,也存在"SQL注入"安全性问题。 //看看SubSonic的处理 太爽了,嗯,有了VS的"智能感应",可以极大减少犯SQL错误的烦恼了。 再举一例,想用SubSonic多种方式来实现数据的添加,同样显示在gridview中,如图 //method 1 //method 2 //this method 'Insert' can not be overloaded ,So you must takes all of arguments //method 3 //method 4 5 6……非常灵活 SubSonic为你的数据库里的每个表生成三个类: 1.表名奇数形式的类;例如有一个表Products,类名就是Product,这是一个强类型的类代表数据库表中的一行数据,表中的每一列对应类中的强类型的属性名,允许null的字段定义为nullable 2.集合类:例如一个表Products

SubSonic学习(一)

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 22:50:06
月圆之夜,窗外炮竹声不绝于耳,今晚,幸福属于我们每个人! 忽然想起一句和元宵佳节有关的诗“众里寻他千百度,蓦然回首,那人却在灯火阑珊处”。诗中的哲理蕴含在日常生活的每一个角落。 毕业刚半年,接触SubSonic时间也不长,所以只想把自己的学习笔记整理下,望能抛砖引玉了(参考 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 //创建一个自动生成类的buildProvider //.abp文件中指明将哪些数据库表自动生成类,表名按行列出;所有都生成时,输入* 2.Load an object a) FetchByID //SubSonic will not work with tables that do not have a primary key Product product =

Subsonic: dynamic connections

天涯浪子 提交于 2019-11-27 19:05:45
问题 I have an ancient mess I'm trying to shovel into tiers using subsonic. Trouble is, I have this scenario: When Hal logs in, his login uses database X for lookup data, database Y for his accounts and database Z for his contacts. When Barry logs in, his login uses database X for lookupdata, database Q for his accounts and database R for his contacts. X,Y,Z,Q and R are all on the same server. Y has an indentical schema to Q, and and Z has an identical schema to R. Don't get me started on how

Benchmark Linq2SQL, Subsonic2, Subsonic3 - Any other ideas to make them faster?

故事扮演 提交于 2019-11-27 03:57:20
问题 I am working with Subsonic 2 more than 3 years now... After Linq appears and then Subsonic 3, I start thinking about moving to the new Linq futures that are connected to sql. I must say that I start move and port my subsonic 2 with SubSonic 3, and very soon I discover that the speed was so slow thats I didn't believe it - and starts all that tests. Then I test Linq2Sql and see also a delay - compare it with Subsonic 2. My question here is, especial for the linq2sql, and the up-coming dotnet

Subsonic Vs NHibernate

丶灬走出姿态 提交于 2019-11-27 02:47:14
What is the concensus on when to use one of these tools adversed to the other? I find Subsonic very useful in terms of getting things done quickly, but on large projects it tends not to scale, and its ties your domain model to your database model. That is where Nhibernate comes in as it gives you lightweight POCOs that are unrelated to your database model, but the setup time is much longer. I get asked this question a lot and really it comes down to how much you want to fiddle. I can't tell you how damaging Chris Cyvas's comments RE SubSonic scaling have been - and I've been responding to

Benchmark Linq2SQL, Subsonic2, Subsonic3 - Any other ideas to make them faster?

不羁的心 提交于 2019-11-26 19:08:51
I am working with Subsonic 2 more than 3 years now... After Linq appears and then Subsonic 3, I start thinking about moving to the new Linq futures that are connected to sql. I must say that I start move and port my subsonic 2 with SubSonic 3, and very soon I discover that the speed was so slow thats I didn't believe it - and starts all that tests. Then I test Linq2Sql and see also a delay - compare it with Subsonic 2. My question here is, especial for the linq2sql, and the up-coming dotnet version 4, what else can I do to speed it up ? What else on linq2sql settings, or classes, not on this

jQuery Autocomplete and ASP.NET

我们两清 提交于 2019-11-26 15:00:54
I searched all over this site and the web for a good and simple example of autocomplete using jQuery and ASP.NET. I wanted to expose the data used by autocomplete with a webservice (and will probably do that next). In the meantime, I got this working, but it seems a little hacky... In my page I have a text box: <input id="txtSearch" type="text" /> I am using jQuery autocomplete, set up per their example: <link rel="stylesheet" href="js/jquery.autocomplete.css" type="text/css" /> <script type="text/javascript" src="js/jquery.bgiframe.js"></script> <script type="text/javascript" src="js/jquery

SubSonic ASP.NET MVC sample in Visual Web Developer Express

回眸只為那壹抹淺笑 提交于 2019-11-26 11:15:19
问题 In Visual Web Developer Express 2008 the SubSonic ASP.NET MVC template doesn\'t seem to work with a new database I added. I removed the Chinook Database and created my own one. I understand the the .tt files in the Models folder are used to generate code, but they don\'t (despite changing the ConnectionStringName to what I set in the web.config) Right clicking on each .tt file and selecting \'Run Custom Tool\' does not generate anything, except an error message: Cannot find custom tool \

Subsonic Vs NHibernate

若如初见. 提交于 2019-11-26 10:15:34
问题 What is the concensus on when to use one of these tools adversed to the other? I find Subsonic very useful in terms of getting things done quickly, but on large projects it tends not to scale, and its ties your domain model to your database model. That is where Nhibernate comes in as it gives you lightweight POCOs that are unrelated to your database model, but the setup time is much longer. 回答1: I get asked this question a lot and really it comes down to how much you want to fiddle. I can't

jQuery Autocomplete and ASP.NET

岁酱吖の 提交于 2019-11-26 04:07:37
问题 I searched all over this site and the web for a good and simple example of autocomplete using jQuery and ASP.NET. I wanted to expose the data used by autocomplete with a webservice (and will probably do that next). In the meantime, I got this working, but it seems a little hacky... In my page I have a text box: <input id=\"txtSearch\" type=\"text\" /> I am using jQuery autocomplete, set up per their example: <link rel=\"stylesheet\" href=\"js/jquery.autocomplete.css\" type=\"text/css\" />