|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Access是一种桌面数据库,只适合数据量少的应用,在处理少量数据和单机访问的数据库时是很好的,效率也很高。但是它的同时访问客户端不能多于4个。access数据库有一定的极限,如果数据达到100M左右,很容易造成服务器iis假死,或者消耗掉服务器的内存导致服务器崩溃。adoADO.NET2.0FeatureMatrix
BobBeauchemin
DevelopMentor
July2004
Appliesto:
MicrosoftADO.NET2.0
MicrosoftSQLServer2005
Summary:ADO.NET2.0includesanewbase-classprovidermodel,featuresforallproviders,and
changestoSystem.Data.SqlClient.Getanoverviewofthesenewfeatures,examplesoftheiruse,anda
chartofwhichfeaturesareprovider-neutralandSqlClient-specific.(14printedpages)
Contents
TheBase-Class-BasedProviderModel
ConnectionPoolingEnhancements
AsynchronousCommands
BulkImport
ProviderStatistics
AttachDbFileName
SQLServer2005-SpecificFeaturesinSqlClient
Conclusion
ADO.NET2.0comeswithaplethoraofnewfeatures.Thisincludesanewbase-classCbasedprovider
modelandfeaturesthatallproviderscantakeadvantageof,aswellaschangesthatarespecificto
System.Data.SqlClient.Becausethe.NETFramework2.0isbeingreleasedinconjunctionwithSQL
Server2005,someofthesefeaturesrequireSQLServer2005tobeusable.Thisarticleismeanttoserve
asanoverviewandroadmapofthenewfeatures,giveexamplesoftheiruse,andincludesachartof
whichfeaturesareprovider-neutralandwhichareSqlClient-specific.Infuturearticlesinthisseries,Ill
begoingoversomeofthefeaturesingreaterdetail.Inaddition,therearemanynewfeaturesofthe
DataSetandfriends;thesewillbecoveredinfuturearticles.
TheBase-Class-BasedProviderModel
InADO.NET1.0and1.1,providerwritersimplementedaseriesofprovider-specificclasses.Generic
codingwaspossiblebasedonthefactthateachoftheclassesimplementedagenericinterface.Asan
example,System.Data.SqlClientcontainstheclassSqlConnectionandthisclassimplements
IDbConnection.System.Data.OracleClientcontainstheclassOracleConnection,whichalso
implementsIDbConnection.Theprovider-specificclassescouldimplementdata-sourceCspecific
propertiesandmethods,e.g.,SqlConnectionimplementstheDatabasepropertyandthe
ChangeDatabasemethod.OracleConnectiondoesnot,becausetheOracledatabasedoesnothavethe
conceptofmultiple"databases"(theseareknownascatalogsinANSISQL)perdatabaseinstance.The
newprovidermodelinADO.NET2.0isbasedonaseriesofbaseclassesinSystem.Data.Common.
Theseprovideabasicimplementationofcommonfunctionalityand,ofcourse,eachofthebaseclasses
implementsthestill-requiredgenericinterfaceforbackwardcompatibility.Providerwriterscanchooseto
usethebaseclassesorsupporttheinterfaces.
Thereweretwoexceptionstotheinterfacemodelinpreviousversions,the
DataAdapter/DbDataAdapterandCommandBuilder.TheCommandBuilderclassprovidesan
automaticimplementationofINSERT,UPDATE,andDELETEcommandsthatusethesamecolumn-set,
forasimpleSELECTcommand.ExtendingaCommandBuilderwhilekeepingthebasealgorithmthatit
usedtocreateactionstatementswasnotpossiblebecausetheSqlCommandBuilderwasasealedclass.
AlthoughthereisstillnowaytoreusetheSqlCommandBuilderparameterparser,thereisa
DbCommandBuilderbaseclassinSystem.Data.Common.Therearenewfeaturesexposedatthe
base-classlevelintheseclasses,too.TheDataAdapter/DbDataAdapterbaseclassesexposemechanisms
forpushingprovider-specifictypeslikeSQLServerSqlTypesintotheDataSet(the
ReturnProviderSpecificTypesproperty)andforbatchupdates(StatementType.Batchenumeration
valueandUpdateBatchSizeproperty).TheDbCommandBuildercommonbaseclassincludesaproperty
toindicateconcurrencypolicychoices(theConflictDetectionproperty).
ProviderFactories
Oneofthecomplicationsoftheinterface-basedapproachinADO.NET1.0and1.1isthatyoucantcalla
constructoronaninterface.Youmustcreateaconcreteinstanceofaspecificclass.PreviousAPIslike
OLEDBandADOworkedaroundthisbyoverloadingtheconnectionstring.Theconnectionstring
containedtheCOMPROGIDoftheprovider,andthecorrectDataSourceclasswascreatedbasedonthis
PROGID.ThiswaspossiblebecauseOLEDBDataSourcePROGIDswerestoredintheregistry.
VB6ADOcode,Connectionisaninterface(actuallyits_Connection)
DimconnasConnection
notethatthedefaultproviderisMSDASQL,theOLEDBproviderforODBC
thisusestheOLEDBproviderforSQLServer
conn.ConnectionString="provider=sqloledb;.."otherparameters
deleted
conn.Open
ADO.NET2.0hasasolutionforthis.EachdataproviderregistersaProviderFactory</p>源代码保护方面其实现在考虑得没那么多了..NET也可以反编译.ASP写得复杂的话别人能看得懂的话.他也有能力自己写了.这方面担心的倒不太多.纵观现在网上可以下载的那些所谓BBS还有什么网站等等的源代码 |
|