- Programming with SqlClient
- Context: The SqlContext Class
- Commands: Making Things Happen
- Obtaining Results
- Creating and Sending New Rowsets
- Using the WindowsIdentity
- Calling a Web Service from SQLCLR
- Exception Handling
- SqlClient Classes That You Can’t Use on the Server
- Where Are We?
Where Are We?
This chapter looked at using the SqlClient managed provider inside .NET Framework procedural code in depth. In Chapter 3, however, we stated that T-SQL is almost always best for data-centric code. When, then, is the best time to use the provider in process? These cases include when it’s appropriate to mix .NET Framework–specific logic with data access code. Another case might be where structured exception handling is desired. In addition, because the programming model is similar enough (though not identical) to using SqlClient on the client, middle tier, and server, some existing .NET Framework code might be moved into the server for locality-of-reference benefits.