View
216
Download
0
Category
Preview:
Citation preview
Native Support for Web Native Support for Web ServicesServices Native Web services accessNative Web services access
Enables cross platform Enables cross platform interoperabilityinteroperability
Reduces middle-tier dependency (no Reduces middle-tier dependency (no IIS)IIS)
Simplifies management and Simplifies management and administrationadministration
Returns results via SOAP and XMLReturns results via SOAP and XML
New HTTP ENDPOINT objectNew HTTP ENDPOINT object Encourage database object re-use Encourage database object re-use Support service oriented architecturesSupport service oriented architectures Easy maintenance via loose couplingEasy maintenance via loose coupling
SOAP/XML/HTTP
SPSPTSQL
SPSPSPSP
Non Windows
configure connection infoconfigure authenticationexpose stored procedures
expose TSQL batches
Web SvcEndpoints
Note: Requires Windows 2003
Server
Data TypesData Types
CLR-based Data TypesCLR-based Data Types
VARCHAR(MAX), VARBINARY(MAX)VARCHAR(MAX), VARBINARY(MAX)
XML DatatypeXML Datatype
.Net Framework.Net Framework
Common Language Runtime IntegrationCommon Language Runtime Integration
Ability to create database objects such as UDFs Ability to create database objects such as UDFs and Stored Procedures with VB.Net.and Stored Procedures with VB.Net.
To expose a Stored Procedure:To expose a Stored Procedure:The containing class must be publicThe containing class must be publicThe exposed method must be publicThe exposed method must be publicThe exposed method must be static (C#) or The exposed method must be static (C#) or Shared (VB)Shared (VB)
.Net Framework.Net Framework
CLR-basedCLR-based Types, Functions, & Functions, & TriggersTriggers
Developers are able to create Developers are able to create two new objects: user-defined two new objects: user-defined types and aggregates.types and aggregates.
Using VB or C# code, you can write your own aggregator functions, such as those which select results based on string or numerical properties or calculations—something you can't do in T-SQL.
Custom AggregateCustom AggregateCLR ClassCLR Class
Class is called during the aggregationClass is called during the aggregationNot just passed a set of values, but one at a timeNot just passed a set of values, but one at a timeMust be serializable (for intermediate results)Must be serializable (for intermediate results)Must implement known methodsMust implement known methods
InitInit Called at the start of the aggregation of fieldsCalled at the start of the aggregation of fields
AccumulateAccumulate Called once for each row being aggregated. It is passed Called once for each row being aggregated. It is passed
the value from the column being aggregated.the value from the column being aggregated.MergeMerge
Called to merge a temporary result into the aggregateCalled to merge a temporary result into the aggregateTerminateTerminate
Called at the end of the aggregation process to retrieve Called at the end of the aggregation process to retrieve the result of the aggregation.the result of the aggregation.
CLR ClassCLR ClassClass is called during the aggregationClass is called during the aggregationNot just passed a set of values, but one at a timeNot just passed a set of values, but one at a timeMust be serializable (for intermediate results)Must be serializable (for intermediate results)Must implement known methodsMust implement known methods
InitInit Called at the start of the aggregation of fieldsCalled at the start of the aggregation of fields
AccumulateAccumulate Called once for each row being aggregated. It is passed Called once for each row being aggregated. It is passed
the value from the column being aggregated.the value from the column being aggregated.MergeMerge
Called to merge a temporary result into the aggregateCalled to merge a temporary result into the aggregateTerminateTerminate
Called at the end of the aggregation process to retrieve Called at the end of the aggregation process to retrieve the result of the aggregation.the result of the aggregation.
Custom UDTsCustom UDTsUDTs behave just like any other data type
on the server. You can create tables with UDT columns, use UDTs as variables to stored procedures, pass them as parameters, and so on. You can define UDTs using any .NET language.
They expose properties and methods that can be invoked from T-SQL on the SQL Server.
On the client side, you can use a UDT as you would any other object. After referencing the assembly containing the UDT class, you can use that class from within your data access layer ADO.NET code.
UDTs behave just like any other data type on the server. You can create tables with UDT columns, use UDTs as variables to stored procedures, pass them as parameters, and so on. You can define UDTs using any .NET language.
They expose properties and methods that can be invoked from T-SQL on the SQL Server.
On the client side, you can use a UDT as you would any other object. After referencing the assembly containing the UDT class, you can use that class from within your data access layer ADO.NET code.
Possible UsesPossible Uses
Validate Zip Codes as part of INSERT or UPDATE with a Web Service call
User defined type of zip-code.
Field constraint that validates email address format using a regular expression.
Others ?? Speak up audience !!
Imagine the possibilities …
Validate Zip Codes as part of INSERT or UPDATE with a Web Service call
User defined type of zip-code.
Field constraint that validates email address format using a regular expression.
Others ?? Speak up audience !!
Imagine the possibilities …
.NET Integration Choices.NET Integration Choices
Choice of where to run logicChoice of where to run logic Database, for logic that runs close to dataDatabase, for logic that runs close to data Mid-tier, for logic that scales outMid-tier, for logic that scales out Symmetric programming model (same in Symmetric programming model (same in
code & db)code & db)Leverage skills middle tier & serverLeverage skills middle tier & server
Choice of programming language Choice of programming language VB.NET for a safe, modern execution VB.NET for a safe, modern execution
environmentenvironment T-SQL continues to be supported & enhancedT-SQL continues to be supported & enhanced
Remains good choice for data-intensive proceduresRemains good choice for data-intensive procedures
Safe extended stored proc (xp) Safe extended stored proc (xp) replacement replacement
Much higher performance for some Much higher performance for some scenariosscenarios
.Net Framework.Net Framework
Benefits:Benefits:
Your critical .Net processes gain the enforcement, security, scalability, and high availability characteristics of SQL Server 2005
VS 2005 VS 2005 ProjectProject
Assembly: “taxlib.dll”
VB.NetVB.Net BuildBuild
SQL ServerSQL Server
SQL Data Definition:SQL Data Definition: create assembly … create function … create procedure … create trigger … create type …SQL Queries: SQL Queries:
select sum(tax(sal,state)tax(sal,state))from Employee where county = 'King'
Runtime hosted by SQL
(in-proc)
The Developer ExperienceThe Developer Experience
-Integrated Development and Debugging
- GridView control integration
Managing AssembliesManaging Assemblies Loaded and stored inside SQL ServerLoaded and stored inside SQL Server
Cataloged Cataloged with CREATE ASSEMBLYwith CREATE ASSEMBLY Dropped with DROP ASSEMBLYDropped with DROP ASSEMBLY
Collated as sets of filesCollated as sets of files Assembly, References, PDB, source filesAssembly, References, PDB, source files
Managing AssembliesManaging Assemblies Code Access Security (CAS) for Code Access Security (CAS) for
AssembliesAssemblies Three CAS BucketsThree CAS Buckets
SAFESAFEAccess to the CLR onlyAccess to the CLR onlyNo access to external resources, thread No access to external resources, thread
management, unsafe code or interopmanagement, unsafe code or interop
EXTERNAL_ACCESSEXTERNAL_ACCESSAccess to external systems through the .NET Access to external systems through the .NET
FrameworkFrameworkE.g. EventLog, FileSystem and NetworkE.g. EventLog, FileSystem and NetworkNo access unsafe or interopNo access unsafe or interop
UNSAFEUNSAFENo restrictions; similar to extended stored proceduresNo restrictions; similar to extended stored procedures
Recommended