Microsoft.SqlServer.Server


Chapter 25, “Data Access with .NET,” discussed classes from the namespace System.Data.SqlClient. Another namespace we will talk about is the Microsoft.SqlServer.Server namespace. The Microsoft.SqlServer.Server namespace includes classes, interfaces, and enumerations specific to the .NET Framework. However, many of the System.Data.SqlClient classes are also needed within server side code as you will see.

The following table lists major classes from the Microsoft.SqlServer.Server namespace and their functionality.

Open table as spreadsheet

Class

Description

SqlContext

Like an HTTP context, the SQL context is associated with the request of a client. With static members of the SqlContext class, SqlPipe, SqlTriggerContext, and WindowsIdentity can be accessed.

SqlPipe

With the SqlPipe class results or information can be sent to the client. This class offers the methods ExecuteAndSend(), Send(), and SendResultsRow(). The Send() method has different overloads to either send a SqlDataReader, SqlDataRecord, and string.

SqlDataRecord

The SqlDataRecord represents a single row of data. This class is used in conjunction with SqlPipe to send or receive information from the client.

SqlTriggerContext

The SqlTriggerContext class is used within triggers. This class provides information about the trigger that was fired.

This namespace also includes several attribute classes: SqlProcedureAttribute, SqlFunctionAttribute, SqlUserDefinedAttribute, and SqlTriggerAttribute. These classes are used for deployment of stored procedures, functions, user-defined types, and triggers in SQL Server. When deploying from Visual Studio, it is required that you apply these attributes. When deploying the database objects using SQL statements, these attributes are not needed but help, as some properties of these attributes influence the characteristics of the database objects.

You see these classes in action later in this chapter when writing stored procedures and user-defined functions is discussed, but first, the following section looks into creating user-defined types with C#.




Professional C# 2005 with .NET 3.0
Professional C# 2005 with .NET 3.0
ISBN: 470124725
EAN: N/A
Year: 2007
Pages: 427

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net