SQLSERVER一些公用DLL的作用解釋
如果你的SQLSERVER安裝在C盤的話,下面的路徑就是相應SQLSERVER版本的公用DLL的存放路徑
SQL2005
C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies\


SQL2008
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\


SQL2012
C:\Program Files\Microsoft SQL Server\110\SDK\Assemblies\



可以看到隨着SQLSERVER版本的升級,這些公用DLL變得越來越多了,因為SQLSERVER的功能越來越多了

這些DLL有什么用??
這些DLL是供SQLSERVER調用的,因為這些公用DLL在SQLSERVER的很多組件中都有用到,所以SQLSERVER就把這些
DLL放到X:\Program Files\Microsoft SQL Server\X\SDK\Assemblies\文件夾下以供其他SQLSERVER組件調用
例如SSIS、SSAS、數據庫引擎還有其他的工具
其實從文件夾路徑名我們就可以知道這些DLL的作用:SDK\Assemblies\
大家不知道SDK的含義可以百度一下,不過可能大家比較賴,我就貼出來吧
SDK(Software Development Kit, 即軟件開發工具包 )一般是一些被軟件工程師用於為特定的軟件包、軟件框架、硬件平台、操作系統等
建立應用軟件的開發工具的集合。
資深程序員一定知道SDK的作用,他就是某個軟件提供給我們程序員用來開發的一些接口或者API
本人覺得X:\Program Files\Microsoft SQL Server\X\SDK\Assemblies\文件夾下面的這些DLL不只是提供給SQLSERVER調用的
我們也可以調用這些DLL來開發SQLSERVER數據庫的一些相關軟件和工具
例子一:
園子里的胡勇大俠就用了下面的兩個DLL來做出了: (噴血分享)利用.NET生成數據庫表的創建腳本,類似SqlServer編寫表的CREATE語句
Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Management.Sdk.Sfc.dll
例子二:
又例如這個帖子:用c#做了個,sqlServer2005里面那個事件監控器一樣的程序,啟動問題請幫看看
用Microsoft.SqlServer.ConnectionInfo.dll這個DLL做一個類似於SQL TRACE的工具出來,用來實時查看執行的腳本以及其他信息
例子三:
SQLDoc Sharp(SQLSERVER數據庫文檔生成工具)
這個工具在codeproject上可以下載:http://www.codeproject.com/Articles/35790/SQLDoc-Sharp
用到了下面的DLL
Microsoft.SqlServer.ConnectionInfo.dll
Microsoft.SqlServer.Management.Sdk.Sfc.dll
Microsoft.SqlServer.Smo.dll
Microsoft.SqlServer.SmoExtended.dll
Microsoft.SqlServer.SqlEnum.dll

公用DLL用什么語言編寫?
我們可以發現上面的三個例子中的工具都是用.NET編寫的工具,包括SQLDoc Sharp都是用.NET編寫的winfrom軟件
我們用ILSpy這個軟件反編譯一下各個SQLSERVER版本的下DLL
將DLL全部拖入去ILSpy里面
SQL2005

SQL2008


SQL2012

SQL2008里面有兩個DLL是不能夠反編譯的,分別是Redist_TSqlLanguageService.dll和Redist_DACFramework.dll
SQL2012里面只有一個DLL是不能夠反編譯的,是Redist_TSqlLanguageService.dll
不能被反編譯的DLL有可能是用C或者C++編寫的
我估計這些不能反編譯的dll不會提供API功能給用戶,只是給SQLSERVER調用的,而且這些DLL對於SQLSERVER的性能有至關重要的作用
所以用C或者C++編寫
從上面反編譯這些DLL的情況來看,SQLSERVER里面有很大一部分組件或者代碼都是用.NET來編寫的
除了一些關鍵功能或者涉及到性能相關的功能組件用C或者C++編寫
這里從另一個側面也可以看出微軟對.NET的重用,從SQLSERVER2005開始大量用.NET來編寫一些組件代碼
從上面三個例子中也可以看出為什麽他們首選.NET來編寫這些工具,因為這些公用DLL本來就是.NET DLL(可托管代碼)
簡單介紹DLL
限於本人的能力有限,本人就只簡單介紹比較熟悉的DLL,其他不熟悉的大家可以查MSDN或者百度
我這里會給出一些DLL的資料和查百度、MSDN時候的結果
我這里只介紹SQLSERVER2012的,因為SQLSERVER2012比較齊全,但是某些功能在不同的SQLSERVER版本里會有變化
例如上面第二個例子里:用c#做了個,sqlServer2005里面那個事件監控器一樣的程序,啟動問題請幫看看
里面說到了TMO這個類在SQL2005版本的SDK里面和SQL2008版本的SDK里面有變化,導致運行時出錯
使用Trace Management Object監測和診斷SQL Server(一)
在SQL Server 2005里TMO對象被實現在了Microsoft.SqlServer.ConnectionInfo.dll里,
在SQL Server 2008里TMO對象則被移到了Microsoft.SqlServer.ConnectionInfoExtended.dll里,
但仍然在Microsoft.SqlServer.Management.Trace命名空間里。
類似上面的有變化的API我就不說了,大家開發的時候一定要查清楚MSDN和百度,不要搞錯,因為這些SDK的文檔比較少
大部分都是E文的,開發起來會比較頭痛
廢話不說了,開始~
Microsoft.AnalysisServices.DLL
Microsoft.DataWarehouse.Interfaces.DLL
SSAS,數據倉庫相關的接口
Kpi 類:http://technet.microsoft.com/zh-cn/library/microsoft.analysisservices.kpi.aspx



Microsoft.ExceptionMessageBox.DLL
SQLSERVER中的各種異常對話框都調用這個DLL



Microsoft.ReportingServices.Interfaces.DLL
SSRS的相關的接口
http://support.microsoft.com/kb/873267/zh-cn


Microsoft.SqlServer.Smo.DLL
Microsoft.SqlServer.SmoExtended.DLL
Microsoft.SqlServer.Management.Sdk.Sfc.DLL
Microsoft.SqlServer.ConnectionInfo.DLL
Microsoft.SqlServer.ConnectionInfoExtended.DLL
SMO:SQLSERVER管理對象
監控SQLSERVER或者連接SQLSERVER用到
提供SMO對象功能,是SqlServer Management Ojbects的簡稱,由SQL2005提供的管理對象
只要SQL Server Management Studio能實現的東西,用smo都能實現,因為SQL Server Management Studio就是用smo開發的。
如果你有足夠的實力,完全可以開發一個可以藐視SQL Server Management Studio的工具,比如加入智能感知的功能
為了支持 SQL Server 的管理,Integration Services 提供了可以遍歷 SQL 管理對象 (SMO) 的對象的枚舉器。
例如,包可使用 SMO 枚舉器對某個 SQL Server 安裝中的 Jobs 集合中的每個作業執行相同的管理功能。
http://support.microsoft.com/kb/956026/zh-cn
http://support.microsoft.com/kb/922214/zh-cn
http://blogs.msdn.com/b/sqlcrd/archive/2009/01/14/trace-management-object-sql-server.aspx
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.aspx






Microsoft.SqlServer.Dts.Design.DLL
Microsoft.SqlServer.DTSPipelineWrap.DLL
Microsoft.SQLServer.DTSRuntimeWrap.DLL
Microsoft.SQLServer.ManagedDTS.DLL
Data Transformation Services (DTS) 數據傳輸服務相關的DLL
http://bbs.csdn.net/topics/200087190


Microsoft.SqlServer.Management.RegisteredServers.DLL
注冊服務器需要用到的DLL



Microsoft.SqlServer.Management.Utility.DLL
Microsoft.SqlServer.Management.UtilityEnum.DLL
Utility:實用工具類代表一個控制點(UCP)定義的SQL服務器來管理一個或多個的遠程SQLSERVER實例的方法和屬性
UtilityEnum:該microsoft.sqlserver.management.utility命名空間包含展現SQLSERVER實用工具對象的類
http://msdn.microsoft.com/zh-cn/library/ee242093(v=sql.110).aspx
http://technet.microsoft.com/zh-cn/magazine/microsoft.sqlserver.management.utility(SQL.105).aspx


Microsoft.SqlServer.Management.XEvent.DLL
Microsoft.SqlServer.Management.XEventEnum.DLL
擴展事件相關的DLL
XEvent:在SQLSERVER客戶端組件和服務器端組件里創建和使用SQLSERVER擴展事件通過通用對象模型
擴展事件基礎設施支持SQL服務器事件數據的相關性
在某些情況下,基礎設施也可以用於從數據看應用程序和操作系統里獲取相關數據
http://msdn.microsoft.com/zh-cn/library/microsoft.sqlserver.management.xevent.aspx


Microsoft.SqlServer.OlapEnum.DLL
olap系統相關的DLL


Microsoft.SqlServer.Rmo.DLL
Microsoft.SqlServer.Replication.DLL
與復制相關的DLL
RMO:復制管理對象
Microsoft.SqlServer.Replication.dll 引發的IIS異常




Microsoft.SqlServer.ServiceBrokerEnum.DLL
ServiceBroker相關技術的DLL
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.broker.servicebroker.aspx


Microsoft.SqlServer.SqlWmiManagement.DLL
Microsoft.SqlServer.WmiEnum.DLL
與WMI(Windows Management Instrumentation,Windows 管理規范)相關的DLL
http://support.microsoft.com/kb/967199
打開【SQL Server 配置管理器】提示:無法連接到 WMI 提供程序。您沒有權限或者該服務器無法訪問。
請注意,您只能使用 SQL Server 配置管理器來管理 SQL Server 2005 服務器。




Microsoft.SqlServer.SString.DLL
SecureString這個類里面有很多字符串相關的C#函數
這個類里面的代碼
類:SqlSecureString
1 using System; 2 using System.Data.SqlTypes; 3 using System.Globalization; 4 using System.Runtime.InteropServices; 5 using System.Security; 6 using System.Security.Cryptography; 7 using System.Security.Permissions; 8 using System.Text; 9 using System.Xml; 10 using System.Xml.Schema; 11 using System.Xml.Serialization; 12 namespace Microsoft.SqlServer.Common 13 { 14 public sealed class SqlSecureString : ICloneable, IComparable, IComparable<SqlSecureString>, IDisposable, IXmlSerializable 15 { 16 private SecureString data; 17 private int length; 18 private static SqlSecureString empty; 19 private static byte[] additionalEntropy; 20 public char this[int index] 21 { 22 get 23 { 24 return this.ToString()[index]; 25 } 26 } 27 public static SqlSecureString Empty 28 { 29 get 30 { 31 return SqlSecureString.empty; 32 } 33 } 34 public int Length 35 { 36 get 37 { 38 return this.length; 39 } 40 } 41 static SqlSecureString() 42 { 43 SqlSecureString.additionalEntropy = new byte[] 44 { 45 2, 46 0, 47 0, 48 8, 49 0, 50 4 51 }; 52 SqlSecureString.empty = new SqlSecureString(); 53 } 54 public SqlSecureString() 55 { 56 this.data = new SecureString(); 57 this.length = 0; 58 } 59 public SqlSecureString(string str) 60 { 61 if (str == null) 62 { 63 throw new ArgumentNullException(); 64 } 65 this.data = new SecureString(); 66 this.length = 0; 67 char[] array = str.ToCharArray(); 68 for (int i = 0; i < array.Length; i++) 69 { 70 char c = array[i]; 71 this.data.AppendChar(c); 72 this.length++; 73 } 74 } 75 public SqlSecureString(SecureString secureString) 76 { 77 if (secureString == null) 78 { 79 throw new ArgumentNullException(); 80 } 81 this.data = secureString.Copy(); 82 this.length = secureString.Length; 83 } 84 public SqlSecureString(IntPtr bstr, int length) 85 { 86 if (bstr == IntPtr.Zero) 87 { 88 throw new ArgumentNullException(); 89 } 90 string text = Marshal.PtrToStringAuto(bstr, length); 91 this.data = new SecureString(); 92 this.length = 0; 93 char[] array = text.ToCharArray(); 94 for (int i = 0; i < array.Length; i++) 95 { 96 char c = array[i]; 97 this.data.AppendChar(c); 98 this.length++; 99 } 100 } 101 public void Dispose() 102 { 103 if (this.data != null && this != SqlSecureString.empty) 104 { 105 this.data.Dispose(); 106 this.data = null; 107 } 108 } 109 public object Clone() 110 { 111 return this.Copy(); 112 } 113 public static int Compare(SqlSecureString strA, SqlSecureString strB) 114 { 115 return string.Compare((string)strA, (string)strB); 116 } 117 public static int Compare(SqlSecureString strA, SqlSecureString strB, bool ignoreCase) 118 { 119 return string.Compare((string)strA, (string)strB, ignoreCase); 120 } 121 public static int Compare(SqlSecureString strA, SqlSecureString strB, StringComparison comparisonType) 122 { 123 return string.Compare((string)strA, (string)strB, comparisonType); 124 } 125 public static int Compare(SqlSecureString strA, SqlSecureString strB, bool ignoreCase, CultureInfo cultureInfo) 126 { 127 return string.Compare((string)strA, (string)strB, ignoreCase, cultureInfo); 128 } 129 public static int Compare(SqlSecureString strA, int indexA, SqlSecureString strB, int indexB, int length) 130 { 131 return string.Compare((string)strA, indexA, (string)strB, indexB, length); 132 } 133 public static int Compare(SqlSecureString strA, int indexA, SqlSecureString strB, int indexB, int length, bool ignoreCase) 134 { 135 return string.Compare((string)strA, indexA, (string)strB, indexB, length, ignoreCase); 136 } 137 public static int Compare(SqlSecureString strA, int indexA, SqlSecureString strB, int indexB, int length, StringComparison comparisonType) 138 { 139 return string.Compare((string)strA, indexA, (string)strB, indexB, length, comparisonType); 140 } 141 public static int Compare(SqlSecureString strA, int indexA, SqlSecureString strB, int indexB, int length, bool ignoreCase, CultureInfo cultureInfo) 142 { 143 return string.Compare((string)strA, indexA, (string)strB, indexB, length, ignoreCase, cultureInfo); 144 } 145 public static int CompareOrdinal(SqlSecureString strA, SqlSecureString strB) 146 { 147 return string.CompareOrdinal((string)strA, (string)strB); 148 } 149 public static int CompareOrdinal(SqlSecureString strA, int indexA, SqlSecureString strB, int indexB, int length) 150 { 151 return string.CompareOrdinal((string)strA, indexA, (string)strB, indexB, length); 152 } 153 public int CompareTo(object obj) 154 { 155 int result = 1; 156 if (obj != null) 157 { 158 result = this.ToString().CompareTo(obj.ToString()); 159 } 160 return result; 161 } 162 public int CompareTo(SqlSecureString other) 163 { 164 int result = 1; 165 if (other != null) 166 { 167 result = this.ToString().CompareTo(other.ToString()); 168 } 169 return result; 170 } 171 public static SqlSecureString Concat(object obj) 172 { 173 SqlSecureString result; 174 if (obj != null) 175 { 176 result = new SqlSecureString(obj.ToString()); 177 } 178 else 179 { 180 result = new SqlSecureString(); 181 } 182 return result; 183 } 184 public static SqlSecureString Concat(params object[] args) 185 { 186 return new SqlSecureString(string.Concat(args)); 187 } 188 public bool Contains(string value) 189 { 190 if (value == null) 191 { 192 throw new ArgumentNullException(); 193 } 194 return this.ToString().Contains(value); 195 } 196 public bool Contains(SqlSecureString value) 197 { 198 if (value == null) 199 { 200 throw new ArgumentNullException(); 201 } 202 return this.ToString().Contains(value.ToString()); 203 } 204 public SqlSecureString Copy() 205 { 206 return new SqlSecureString(this.data); 207 } 208 public bool EndsWith(SqlSecureString value) 209 { 210 if (value == null) 211 { 212 throw new ArgumentNullException(); 213 } 214 return this.ToString().EndsWith(value.ToString()); 215 } 216 public bool EndsWith(SqlSecureString value, bool ignoreCase, CultureInfo cultureInfo) 217 { 218 if (value == null) 219 { 220 throw new ArgumentNullException(); 221 } 222 return this.ToString().EndsWith(value.ToString(), ignoreCase, cultureInfo); 223 } 224 public override bool Equals(object obj) 225 { 226 bool result = false; 227 if (obj != null) 228 { 229 result = this.ToString().Equals(obj); 230 } 231 return result; 232 } 233 public bool Equals(SqlSecureString other) 234 { 235 return this == other; 236 } 237 public static bool Equals(SqlSecureString strA, SqlSecureString strB) 238 { 239 return strA == strB; 240 } 241 public bool Equals(SqlSecureString other, StringComparison comparisonType) 242 { 243 return this.ToString().Equals((string)other, comparisonType); 244 } 245 public static bool Equals(SqlSecureString strA, SqlSecureString strB, StringComparison comparisonType) 246 { 247 return string.Equals((string)strA, (string)strB, comparisonType); 248 } 249 public static SqlSecureString Format(string format, params object[] arguments) 250 { 251 return new SqlSecureString(string.Format(format, arguments)); 252 } 253 public static SqlSecureString Format(IFormatProvider formatProvider, string format, params object[] arguments) 254 { 255 return new SqlSecureString(string.Format(formatProvider, format, arguments)); 256 } 257 public override int GetHashCode() 258 { 259 return this.ToString().GetHashCode(); 260 } 261 public int IndexOf(char value) 262 { 263 return this.ToString().IndexOf(value); 264 } 265 public int IndexOf(string value) 266 { 267 return this.ToString().IndexOf(value); 268 } 269 public int IndexOf(char value, int startIndex) 270 { 271 return this.ToString().IndexOf(value, startIndex); 272 } 273 public int IndexOf(string value, int startIndex) 274 { 275 return this.ToString().IndexOf(value, startIndex); 276 } 277 public int IndexOf(char value, int startIndex, int count) 278 { 279 return this.ToString().IndexOf(value, startIndex, count); 280 } 281 public int IndexOf(string value, int startIndex, int count) 282 { 283 return this.ToString().IndexOf(value, startIndex, count); 284 } 285 public int IndexOfAny(char[] anyOf) 286 { 287 return this.ToString().IndexOfAny(anyOf); 288 } 289 public int IndexOfAny(char[] anyOf, int startIndex) 290 { 291 return this.ToString().IndexOfAny(anyOf, startIndex); 292 } 293 public int IndexOfAny(char[] anyOf, int startIndex, int count) 294 { 295 return this.ToString().IndexOfAny(anyOf, startIndex, count); 296 } 297 public SqlSecureString Insert(int startIndex, SqlSecureString value) 298 { 299 if (value == null) 300 { 301 throw new ArgumentNullException(); 302 } 303 return new SqlSecureString(this.ToString().Insert(startIndex, value.ToString())); 304 } 305 public SqlSecureString Insert(int startIndex, string value) 306 { 307 if (value == null) 308 { 309 throw new ArgumentNullException(); 310 } 311 return new SqlSecureString(this.ToString().Insert(startIndex, value)); 312 } 313 public static SqlSecureString Join(object separator, object[] value) 314 { 315 return SqlSecureString.Join(separator, value, 0, value.Length); 316 } 317 public static SqlSecureString Join(object separator, object[] value, int startIndex, int count) 318 { 319 if (value == null) 320 { 321 throw new ArgumentNullException(); 322 } 323 if (startIndex < 0 || value.Length < startIndex + count) 324 { 325 throw new ArgumentOutOfRangeException(); 326 } 327 StringBuilder stringBuilder = new StringBuilder(); 328 if (0 < count) 329 { 330 string text = (separator != null) ? separator.ToString() : string.Empty; 331 bool flag = text.Length != 0; 332 int num = startIndex; 333 if (value[num] != null) 334 { 335 stringBuilder.Append(value[num].ToString()); 336 } 337 num++; 338 while (num - startIndex < count) 339 { 340 if (value[num] != null) 341 { 342 if (flag) 343 { 344 stringBuilder.Append(text); 345 } 346 stringBuilder.Append(value[num].ToString()); 347 } 348 num++; 349 } 350 } 351 return new SqlSecureString(stringBuilder.ToString()); 352 } 353 public int LastIndexOf(char value) 354 { 355 return this.ToString().LastIndexOf(value); 356 } 357 public int LastIndexOf(string value) 358 { 359 return this.ToString().LastIndexOf(value); 360 } 361 public int LastIndexOf(char value, int startIndex) 362 { 363 return this.ToString().LastIndexOf(value, startIndex); 364 } 365 public int LastIndexOf(string value, int startIndex) 366 { 367 return this.ToString().LastIndexOf(value, startIndex); 368 } 369 public int LastIndexOf(char value, int startIndex, int count) 370 { 371 return this.ToString().LastIndexOf(value, startIndex, count); 372 } 373 public int LastIndexOf(string value, int startIndex, int count) 374 { 375 return this.ToString().LastIndexOf(value, startIndex, count); 376 } 377 public int LastIndexOfAny(char[] anyOf) 378 { 379 return this.ToString().LastIndexOfAny(anyOf); 380 } 381 public int LastIndexOfAny(char[] anyOf, int startIndex) 382 { 383 return this.ToString().LastIndexOfAny(anyOf, startIndex); 384 } 385 public int LastIndexOfAny(char[] anyOf, int startIndex, int count) 386 { 387 return this.ToString().LastIndexOfAny(anyOf, startIndex, count); 388 } 389 public static bool operator ==(SqlSecureString strA, SqlSecureString strB) 390 { 391 bool result = false; 392 bool flag = strA == null; 393 bool flag2 = strB == null; 394 if (flag && flag2) 395 { 396 result = true; 397 } 398 else 399 { 400 if (!flag && !flag2) 401 { 402 result = (0 == string.CompareOrdinal(strA.ToString(), strB.ToString())); 403 } 404 } 405 return result; 406 } 407 public static bool operator ==(SqlSecureString strA, object strB) 408 { 409 bool result = false; 410 bool flag = strA == null; 411 bool flag2 = strB == null; 412 if (flag && flag2) 413 { 414 result = true; 415 } 416 else 417 { 418 if (!flag && !flag2) 419 { 420 result = (0 == string.CompareOrdinal(strA.ToString(), strB.ToString())); 421 } 422 } 423 return result; 424 } 425 public static bool operator ==(object strA, SqlSecureString strB) 426 { 427 bool result = false; 428 bool flag = strA == null; 429 bool flag2 = strB == null; 430 if (flag && flag2) 431 { 432 result = true; 433 } 434 else 435 { 436 if (!flag && !flag2) 437 { 438 result = (0 == string.CompareOrdinal(strA.ToString(), strB.ToString())); 439 } 440 } 441 return result; 442 } 443 public static bool operator !=(SqlSecureString strA, SqlSecureString strB) 444 { 445 return !(strA == strB); 446 } 447 public static bool operator !=(SqlSecureString strA, object strB) 448 { 449 return !(strA == strB); 450 } 451 public static bool operator !=(object strA, SqlSecureString strB) 452 { 453 return !(strA == strB); 454 } 455 public static SqlSecureString operator +(SqlSecureString strA, SqlSecureString strB) 456 { 457 return SqlSecureString.Concat(new object[] 458 { 459 strA, 460 strB 461 }); 462 } 463 public SqlSecureString PadLeft(int totalWidth) 464 { 465 return new SqlSecureString(this.ToString().PadLeft(totalWidth)); 466 } 467 public SqlSecureString PadLeft(int totalWidth, char paddingChar) 468 { 469 return new SqlSecureString(this.ToString().PadLeft(totalWidth, paddingChar)); 470 } 471 public SqlSecureString PadRight(int totalWidth) 472 { 473 return new SqlSecureString(this.ToString().PadRight(totalWidth)); 474 } 475 public SqlSecureString PadRight(int totalWidth, char paddingChar) 476 { 477 return new SqlSecureString(this.ToString().PadRight(totalWidth, paddingChar)); 478 } 479 public SqlSecureString Remove(int startIndex) 480 { 481 return new SqlSecureString(this.ToString().Remove(startIndex)); 482 } 483 public SqlSecureString Remove(int startIndex, int count) 484 { 485 return new SqlSecureString(this.ToString().Remove(startIndex, count)); 486 } 487 public SqlSecureString Replace(char oldChar, char newChar) 488 { 489 return new SqlSecureString(this.ToString().Replace(oldChar, newChar)); 490 } 491 public SqlSecureString Replace(SqlSecureString oldValue, SqlSecureString newValue) 492 { 493 return new SqlSecureString(this.ToString().Replace(oldValue.ToString(), newValue.ToString())); 494 } 495 public SqlSecureString[] Split(char[] separator) 496 { 497 return SqlSecureString.StringArrayToSqlSecureStringArray(this.ToString().Split(separator)); 498 } 499 public SqlSecureString[] Split(char[] separator, int count) 500 { 501 return SqlSecureString.StringArrayToSqlSecureStringArray(this.ToString().Split(separator, count)); 502 } 503 public SqlSecureString[] Split(char[] separator, StringSplitOptions options) 504 { 505 return SqlSecureString.StringArrayToSqlSecureStringArray(this.ToString().Split(separator, options)); 506 } 507 public SqlSecureString[] Split(char[] separator, int count, StringSplitOptions options) 508 { 509 return SqlSecureString.StringArrayToSqlSecureStringArray(this.ToString().Split(separator, count, options)); 510 } 511 public SqlSecureString[] Split(string[] separator, StringSplitOptions options) 512 { 513 return SqlSecureString.StringArrayToSqlSecureStringArray(this.ToString().Split(separator, options)); 514 } 515 public SqlSecureString[] Split(string[] separator, int count, StringSplitOptions options) 516 { 517 return SqlSecureString.StringArrayToSqlSecureStringArray(this.ToString().Split(separator, count, options)); 518 } 519 public bool StartsWith(SqlSecureString value) 520 { 521 if (value == null) 522 { 523 throw new ArgumentNullException(); 524 } 525 return this.ToString().StartsWith(value.ToString()); 526 } 527 public bool StartsWith(SqlSecureString value, bool ignoreCase, CultureInfo culture) 528 { 529 if (value == null) 530 { 531 throw new ArgumentNullException(); 532 } 533 return this.ToString().StartsWith(value.ToString(), ignoreCase, culture); 534 } 535 public static SqlSecureString[] StringArrayToSqlSecureStringArray(string[] array) 536 { 537 SqlSecureString[] array2 = null; 538 if (array != null) 539 { 540 array2 = new SqlSecureString[array.Length]; 541 for (int i = 0; i < array.Length; i++) 542 { 543 if (array[i] != null) 544 { 545 array2[i] = new SqlSecureString(array[i]); 546 } 547 else 548 { 549 array2[i] = null; 550 } 551 } 552 } 553 return array2; 554 } 555 public SqlSecureString Substring(int startIndex) 556 { 557 return new SqlSecureString(this.ToString().Substring(startIndex)); 558 } 559 public SqlSecureString Substring(int startIndex, int length) 560 { 561 return new SqlSecureString(this.ToString().Substring(startIndex, length)); 562 } 563 public IntPtr ToBstr() 564 { 565 return Marshal.SecureStringToBSTR(this.data); 566 } 567 public SqlSecureString ToLower() 568 { 569 return new SqlSecureString(this.ToString().ToLower()); 570 } 571 public SqlSecureString ToLower(CultureInfo culture) 572 { 573 return new SqlSecureString(this.ToString().ToLower(culture)); 574 } 575 public SqlSecureString ToLowerInvariant() 576 { 577 return new SqlSecureString(this.ToString().ToLowerInvariant()); 578 } 579 public SecureString ToSecureString() 580 { 581 return this.data.Copy(); 582 } 583 public override string ToString() 584 { 585 string result = string.Empty; 586 if (this.Length != 0) 587 { 588 new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Assert(); 589 IntPtr intPtr = Marshal.SecureStringToBSTR(this.data); 590 result = Marshal.PtrToStringBSTR(intPtr); 591 Marshal.ZeroFreeBSTR(intPtr); 592 } 593 return result; 594 } 595 public SqlSecureString ToUpper() 596 { 597 return new SqlSecureString(this.ToString().ToUpper()); 598 } 599 public SqlSecureString ToUpper(CultureInfo culture) 600 { 601 return new SqlSecureString(this.ToString().ToUpper(culture)); 602 } 603 public SqlSecureString ToUpperInvariant() 604 { 605 return new SqlSecureString(this.ToString().ToUpperInvariant()); 606 } 607 public SqlSecureString Trim() 608 { 609 return new SqlSecureString(this.ToString().Trim()); 610 } 611 public SqlSecureString Trim(char[] trimChars) 612 { 613 return new SqlSecureString(this.ToString().Trim(trimChars)); 614 } 615 public SqlSecureString TrimEnd(char[] trimChars) 616 { 617 return new SqlSecureString(this.ToString().TrimEnd(trimChars)); 618 } 619 public SqlSecureString TrimStart(char[] trimChars) 620 { 621 return new SqlSecureString(this.ToString().TrimStart(trimChars)); 622 } 623 public static explicit operator string(SqlSecureString sqlSecureString) 624 { 625 string result = null; 626 if (sqlSecureString != null) 627 { 628 result = sqlSecureString.ToString(); 629 } 630 return result; 631 } 632 public static implicit operator SqlSecureString(string str) 633 { 634 SqlSecureString result = null; 635 if (str != null) 636 { 637 result = new SqlSecureString(str); 638 } 639 return result; 640 } 641 public static implicit operator SecureString(SqlSecureString sqlSecureString) 642 { 643 SecureString result = null; 644 if (sqlSecureString != null) 645 { 646 result = sqlSecureString.data.Copy(); 647 } 648 return result; 649 } 650 public static implicit operator SqlSecureString(SecureString secureString) 651 { 652 SqlSecureString result = null; 653 if (secureString != null) 654 { 655 result = new SqlSecureString(secureString); 656 } 657 return result; 658 } 659 public static explicit operator SqlString(SqlSecureString sqlSecureString) 660 { 661 SqlString result = null; 662 if (sqlSecureString != null) 663 { 664 result = new SqlString(sqlSecureString.ToString()); 665 } 666 return result; 667 } 668 public static implicit operator SqlSecureString(SqlString str) 669 { 670 SqlSecureString result = null; 671 if (!str.IsNull) 672 { 673 result = new SqlSecureString(str.ToString()); 674 } 675 return result; 676 } 677 public void WriteXml(XmlWriter writer) 678 { 679 byte[] array = ProtectedData.Protect(Encoding.Unicode.GetBytes(this.ToString()), SqlSecureString.additionalEntropy, DataProtectionScope.CurrentUser); 680 writer.WriteBase64(array, 0, array.Length); 681 writer.Flush(); 682 } 683 public void ReadXml(XmlReader reader) 684 { 685 reader.Read(); 686 string s = reader.ReadContentAsString(); 687 byte[] array = ProtectedData.Unprotect(Convert.FromBase64String(s), SqlSecureString.additionalEntropy, DataProtectionScope.CurrentUser); 688 this.data = new SecureString(); 689 this.length = 0; 690 char[] chars = Encoding.Unicode.GetChars(array); 691 for (int i = 0; i < chars.Length; i++) 692 { 693 char c = chars[i]; 694 this.data.AppendChar(c); 695 this.length++; 696 } 697 for (int j = 0; j < array.Length; j++) 698 { 699 array[j] = 0; 700 } 701 reader.ReadEndElement(); 702 } 703 public XmlSchema GetSchema() 704 { 705 return null; 706 } 707 } 708 }


Microsoft.SqlServer.Types.DLL
處理SQLSERVER數據類型相關的DLL
Microsoft.SqlServer.Types 命名空間包含了處理層級和特別數據類型的類,例如 geometry 和 geographic數據類型
請教如何應用Microsoft.SqlServer.Types 命名空間
Microsoft.SqlServer.Types 命名空間


總結
SQLSERVER里面有很多管理對象,例如SMO、RMO、TMO、AMO、DMO
TMO:TRACE跟蹤管理對象
AMO:分析管理對象
DMO:分布式管理對象(http://www.cnblogs.com/fineboy/archive/2005/09/03/229406.html)
大家在開發的時候都可以調用這些管理對象提供的API來開發相應的數據庫功能
不過遺憾的是,本人還沒有找到SQLSERVER里面究竟有多少這些管理對象
每個對象的功能,沒有詳細的文檔,網上的資料也很少
相關文章:
用c#做了個,sqlServer2005里面那個事件監控器一樣的程序,啟動問題請幫看看
補充一下:
大家在X:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn路徑下可以看到SQLSERVER的一些功能組件DLL
一些不是很重要功能組件例如數據庫郵件(DatabaseMailengine.DLL)就是使用.NET來編寫的
而一些重要功能組件例如批解釋器(batchparser90.DLL)就使用非.NET語言編寫,所以這些組件你用ILSpy是反編譯不出來的


其實大家有空也可以研究一下這些DLL
例如 DBGHELP.DLL這個DLL應該是用來產生DUMP文件內存轉儲文件的,並且不能反編譯


有空研究一下SQLSERVER這些用.NET寫的代碼你會有收獲的~
如有不對的地方,歡迎大家拍磚o(∩_∩)o
