Top Banner
SQL Server 2005 CLR SQL Server 2005 CLR Integration Integration ADO.NET 2.0 ADO.NET 2.0 Mike Taulty Mike Taulty [email protected] [email protected] http://mtaulty.com http://mtaulty.com
16

SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty [email protected] .

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

SQL Server 2005 CLR IntegrationSQL Server 2005 CLR IntegrationADO.NET 2.0ADO.NET 2.0

Mike Taulty Mike Taulty

[email protected]@microsoft.com

http://mtaulty.comhttp://mtaulty.com

Page 2: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

AgendaAgenda

select top 1 * select top 1 *

fromfrom

[sql2005 developer features][sql2005 developer features]

gogo

waitfor delay ’00:45:00’waitfor delay ’00:45:00’

select *select *

fromfrom

[ado v2 features];[ado v2 features];

gogo

Page 3: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

SQL Server Development TodaySQL Server Development Today

SQL Server SQL Server

RelationalRelationalEngineEngine

StorageStorageEngineEngine SchedulerScheduler

User CodeUser Code(Procedures, Functions, Triggers)(Procedures, Functions, Triggers)

T-SQLT-SQL

…Purpose?

Libraries?

Tools?

Skills?

??Extended sp?Extended sp?COM objects?COM objects?

Page 4: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

System

System.Data System.Xml

System.Web

Globalization

Diagnostics

Configuration

Collections

Resources

Reflection

Net

IO

Threading

Text

ServiceProcess

Security

Design

OleDb

SqlTypes

SqlClient

XPath

XSLT

RuntimeInteropServices

Remoting

Serialization

Serialization

Configuration SessionState

Caching Security

ServicesDescription

Discovery

Protocols

UIHtmlControls

WebControls

System.Drawing

Imaging

Drawing2D

Text

Printing

System.Windows.Forms

Design ComponentModelCommon Language Runtime

Class Loader

IL to NativeCompilers

CodeManager

GarbageCollector

Security Engine Debug Engine

Type Checker Exception Manager

Thread Support COM Marshaler

Base Class Library Support

.NET Assembly

Metadata

Code (CIL)

The .NET Development PlatformThe .NET Development Platform

Page 5: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

SQL Server 2005 DevelopmentSQL Server 2005 Development

SQL Server 2005 SQL Server 2005

RelationalRelationalEngineEngine

StorageStorageEngineEngine SchedulerScheduler

User CodeUser Code(Procedures, Functions, Triggers)(Procedures, Functions, Triggers)

T-SQLT-SQL

System

System.Data System.Xml

System.Web

Globalization

Diagnostics

Configuration

Collections

Resources

Reflection

Net

IO

Threading

Text

ServiceProcess

Security

Design

OleDb

SqlTypes

SqlClient

XPath

XSLT

Runtime

InteropServices

Remoting

Serialization

Serialization

Configuration SessionState

Caching Security

Services

Description

Discovery

Protocols

UI

HtmlControls

WebControls

System.Drawing

Imaging

Drawing2D

Text

Printing

System.Windows.Forms

Design ComponentModel

Common Language Runtime

Class Loader

IL to NativeCompilers

CodeManager

GarbageCollector

Security Engine Debug Engine

Type Checker Exception Manager

Thread Support COM Marshaler

Base Class Library Support

.NET Assembly

Metadata

Code (CIL)

Page 6: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

SQL Server 2005 DevelopmentSQL Server 2005 Development

SQL Server 2005 SQL Server 2005

RelationalRelationalEngineEngine

StorageStorageEngineEngine SchedulerScheduler

User CodeUser Code(Procedures, Functions, Triggers)(Procedures, Functions, Triggers)

T-SQLT-SQL

System

System.Data System.Xml

System.Web

Globalization

Diagnostics

Configuration

Collections

Resources

Reflection

Net

IO

Threading

Text

ServiceProcess

Security

Design

OleDb

SqlTypes

SqlClient

XPath

XSLT

Runtime

InteropServices

Remoting

Serialization

Serialization

Configuration SessionState

Caching Security

Services

Description

Discovery

Protocols

UI

HtmlControls

WebControls

System.Drawing

Imaging

Drawing2D

Text

Printing

System.Windows.Forms

Design ComponentModel

Common Language Runtime

Class Loader

IL to NativeCompilers

CodeManager

GarbageCollector

Security Engine Debug Engine

Type Checker Exception Manager

Thread Support COM Marshaler

Base Class Library Support

.NET Assembly

Metadata

Code (CIL)

Page 7: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

What can we do with CLR code?What can we do with CLR code?

Common T-SQL objects can be implemented in Common T-SQL objects can be implemented in CLR codeCLR code

User defined functions (and table valued functions)User defined functions (and table valued functions)

Stored proceduresStored procedures

TriggersTriggers

Additional objects can be implemented in CLR Additional objects can be implemented in CLR codecode

User Defined TypesUser Defined Types

User Defined Aggregates (MAX, MIN, SUM … )User Defined Aggregates (MAX, MIN, SUM … )

Page 8: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

When do we use CLR code?When do we use CLR code?

T-SQL code is great for CRUD operationsT-SQL code is great for CRUD operations

CLR code is great for;CLR code is great for;

General purposeGeneral purpose

Library support (.NET Framework)Library support (.NET Framework)

Tool support (Visual Studio 2005)Tool support (Visual Studio 2005)

Safety and (by scenario) performanceSafety and (by scenario) performance

““For the dirty jobs T-SQL doesn’t want to do”For the dirty jobs T-SQL doesn’t want to do”

Page 9: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

Where do we use CLR code?Where do we use CLR code?

Round trip Round trip

““Distance” between the code and the dataDistance” between the code and the data

Scale up/out possibilities of different tiersScale up/out possibilities of different tiers

Abstraction of the database technologyAbstraction of the database technology

Security requirementsSecurity requirements

Set-based versus procedural codeSet-based versus procedural code

Possibilities for using shared code libraries in multiple tiersPossibilities for using shared code libraries in multiple tiers

Page 10: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

CLR Code Inside SQL ServerCLR Code Inside SQL Server

DemoDemo

Page 11: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

AgendaAgenda

select top 1 * select top 1 *

fromfrom

[sql2005 developer features][sql2005 developer features]

gogo

waitfor delay ’00:45:00’waitfor delay ’00:45:00’

select *select *

fromfrom

[ado v2 features];[ado v2 features];

gogo

Page 12: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

DemoDemo

ADO.NET Version 2.0ADO.NET Version 2.0

Page 13: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

ADO.NET 2.0 FeaturesADO.NET 2.0 Features

SQL 2005 User Defined Type supportSQL 2005 User Defined Type support

Query notificationsQuery notifications

Asynchronous supportAsynchronous support

Multiple active result setsMultiple active result sets

Client statisticsClient statistics

Factory APIsFactory APIs

DataSet & DataTable enhancementsDataSet & DataTable enhancements

Binary serialization, stand-alone DataTablesBinary serialization, stand-alone DataTables

Bulk Load APIBulk Load API

Page 14: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

SQL Server 2005 ResourcesSQL Server 2005 Resources

Web SitesWeb SitesProduct site Product site http://www.microsoft.com/sql/2005/default.asphttp://www.microsoft.com/sql/2005/default.asp

MSDN Centre MSDN Centre http://http://msdn.microsoft.com/sqlmsdn.microsoft.com/sql

SQL Team SQL Team http://http://www.sqlteam.comwww.sqlteam.com

SQL Junkies SQL Junkies http://http://www.sqljunkies.comwww.sqljunkies.com

SQL Server 2005 Express EditionSQL Server 2005 Express Editionhttp://http://lab.msdn.microsoft.com/express/sql/default.aspxlab.msdn.microsoft.com/express/sql/default.aspx

WebcastsWebcastshttp://msdn.microsoft.com/sql/2005webcasts http://msdn.microsoft.com/sql/2005webcasts

BooksBookshttp://www.microsoft.com/sql/2005/samplechapters.asp http://www.microsoft.com/sql/2005/samplechapters.asp

User GroupsUser Groupshttp://msdn.microsoft.com/usergroups/find.asp http://msdn.microsoft.com/usergroups/find.asp

NewsgroupsNewsgroupsMicrosoft.public.sqlserver.*Microsoft.public.sqlserver.*

Page 15: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

SQL Server 2005 CLR IntegrationSQL Server 2005 CLR IntegrationADO.NET 2.0ADO.NET 2.0

Mike Taulty Mike Taulty

[email protected]@microsoft.com

http://mtaulty.com http://mtaulty.com

Page 16: SQL Server 2005 CLR Integration ADO.NET 2.0 Mike Taulty mtaulty@microsoft.com .

© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.© 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.