Ontwerp van enterprise applicaties op het .NET

Commentaren

Transcriptie

Ontwerp van enterprise applicaties op het .NET
!
!
"
" #"
(
(
#
$% &$'
" )" #
*
+ ,--./,--0
*
!
!
"
" #"
(
(
#
$% &$'
" )" #
*
+ ,--./,--0
*
1
+
2!
+ *
$3& # (
(
*
"
" #"
$% &$'2 (
1 "
1
(
(+
1
*
*
*
"
4
*
6
*
"
#*
7
+
2
$
8
*
*
(
+
*
(+
*
(
"
2
,--0
(
(
(
"
*
*
*
*
( 1 52
1
9 " 3
*
9
*
1
+
")
(
+
(
(
+
*
21
1
*
(
*
#
(
*
(+
(
+
(
)
#
" )"
(
*
$
(+
*
*
(
(
(
*
"
*
+
*
2
(+
(+
*
!
!
"
" #"
(
(
#
$% &$'
" )" #
*
*
+ ,--./,--0
: *
;
1
*
*
+
*
(
"
"
")
4(
( <*
(
*
* ,--0
"
3
#
"
(
+
2
1
(+
1
*
*
(+
1
/
* ")
1
(+
1
(
7 3#8"
2 ")
2 3#
+
/
(
+
1
2
(
1
*
1
,"-2
1
1
5 2
+
(+
,--0
'%
*
=
*
/
INLEIDING............................................................................................................................................................1
1.1 SITUERING ..................................................................................................................................................1
1.1.1
Gandagas .........................................................................................................................................1
1.1.2
Onderzoek van beta-technologieën ..................................................................................................2
1.1.3
Opmerking........................................................................................................................................2
1.2 ENTERPRISE APPLICATIES ...........................................................................................................................2
1.2.1
Definitie............................................................................................................................................2
1.2.2
Client-server model..........................................................................................................................3
1.2.3
3-lagen model...................................................................................................................................4
1.2.4
Fysieke locatie van de lagen ............................................................................................................5
1.2.4.1
1.2.4.2
1.2.4.3
1.2.4.4
Presentatielaag ....................................................................................................................................... 5
Business-logica laag .............................................................................................................................. 6
Datalaag................................................................................................................................................. 6
Communicatie tussen lagen ................................................................................................................... 7
1.3 TESTCRITERIA EN ALGEMENE METHODOLOGIE ...........................................................................................8
1.3.1
Applicatiestructuur...........................................................................................................................8
1.3.2
Uitbreidbaarheid..............................................................................................................................8
1.3.3
Beveiliging .......................................................................................................................................8
1.3.4
Productiviteit....................................................................................................................................9
1.3.5
Performantie ....................................................................................................................................9
1.4 PERFORMANTIETESTS .................................................................................................................................9
1.4.1
Testnetwerk .................................................................................................................................... 10
1.4.2
Enterprise Library.......................................................................................................................... 11
1.4.3
CLR Profiler................................................................................................................................... 12
1.4.4
Opmerking omtrent beta-technologie............................................................................................. 12
1.5 ANDERE APPLICATIEASPECTEN ................................................................................................................ 13
1.6 OPBOUW VAN DIT WERK ........................................................................................................................... 13
TECHNOLOGISCHE SITUERING.................................................................................................................. 14
2.1 .NET FRAMEWORK 1.X ............................................................................................................................ 14
2.1.1
Introductie...................................................................................................................................... 14
2.1.2
Ontwerpcriteria.............................................................................................................................. 14
2.1.3
“The world is multilanguage” ....................................................................................................... 14
2.1.4
De Common Language Runtime .................................................................................................... 16
2.1.5
De Base Class Library ................................................................................................................... 16
2.1.6
Metadata en deployment ................................................................................................................ 17
2.1.7
Applicatiemodellen......................................................................................................................... 18
2.1.8
Korte vergelijking met COM .......................................................................................................... 18
2.1.9
.NET Framework SDK ................................................................................................................... 18
2.1.10 Extra literatuur .............................................................................................................................. 19
2.2 .NET FRAMEWORK 2.0............................................................................................................................. 19
2.2.1
Introductie...................................................................................................................................... 19
2.2.2
MSBuild.......................................................................................................................................... 19
2.2.3
ClickOnce....................................................................................................................................... 20
2.2.4
ASP.NET 2.0 .................................................................................................................................. 21
2.2.5
ADO.NET 2.0 ................................................................................................................................. 21
2.2.6
Uitbreidingen aan de Base Class Library ...................................................................................... 21
2.3 TOEKOMST VAN HET .NET FRAMEWORK ................................................................................................. 22
2.4 DE VISUAL STUDIO TOOLS ....................................................................................................................... 23
2.4.1
Introductie...................................................................................................................................... 23
2.4.2
Visual Studio .NET 2003 ................................................................................................................ 23
2.4.3
Visual Studio 2005 ......................................................................................................................... 23
2.4.4
Express-tools.................................................................................................................................. 24
2.4.5
Visual Studio 2005 Team System ................................................................................................... 24
2.5 NIEUWE TAALFEATURES IN C# 2.0 ........................................................................................................... 25
2.5.1
Introductie...................................................................................................................................... 25
2.5.2
Generics ......................................................................................................................................... 25
2.5.3
Anonieme methoden ....................................................................................................................... 26
2.5.4
Partiële types ................................................................................................................................. 27
2.5.5
Nullable types................................................................................................................................. 27
2.6 ENTERPRISE LIBRARY .............................................................................................................................. 28
2.6.1
Introductie...................................................................................................................................... 28
2.6.2
Designcriteria ................................................................................................................................ 28
2.6.3
Application blocks.......................................................................................................................... 28
2.7 SQL SERVER 2000 ................................................................................................................................... 30
2.7.1
Introductie...................................................................................................................................... 30
2.7.2
Kwaliteitsattributen........................................................................................................................ 30
2.7.3
Belangrijkste “features” ................................................................................................................ 30
2.7.4
Het SQL Server 2000 “ecosysteem” .............................................................................................. 31
2.8 SQL SERVER 2005 ................................................................................................................................... 31
2.8.1
Introductie...................................................................................................................................... 31
2.8.2
CLR integratie................................................................................................................................ 31
2.8.3
XML ondersteuning........................................................................................................................ 32
2.8.4
SQL Server 2005 Web Services...................................................................................................... 32
2.8.5
T-SQL uitbreidingen ...................................................................................................................... 32
2.8.6
Service Broker................................................................................................................................ 33
2.8.7
Performantie .................................................................................................................................. 35
2.8.8
“Innovation through integration”.................................................................................................. 35
2.8.9
Hogere eisen .................................................................................................................................. 36
2.8.10 Een mijlpaal? ................................................................................................................................. 36
ADO.NET 1.1 ....................................................................................................................................................... 37
3.1 INTRODUCTIE ........................................................................................................................................... 37
3.2 GEBRUIK VAN SQLCLIENT........................................................................................................................ 39
3.3 EENVOUDIG VOORBEELD .......................................................................................................................... 39
3.4 ADO.NET CONNECTIEBEHEER................................................................................................................. 40
3.4.1
Beveiligingsmaatregelen ................................................................................................................ 40
3.4.2
Connecties altijd sluiten................................................................................................................. 41
3.4.3
Het “using” pattern ....................................................................................................................... 41
3.4.4
Connection pooling ........................................................................................................................ 42
3.5 STORED PROCEDURES ............................................................................................................................... 44
3.6 DATASET, DATATABLE EN DATAVIEW.................................................................................................... 45
3.6.1
Het DataSet-objectmodel ............................................................................................................... 45
3.6.2
Ondersteuning door tools............................................................................................................... 46
3.6.3
Strongly typed versus weakly typed DataSets ................................................................................ 46
3.6.4
Optimistic concurrency .................................................................................................................. 48
3.6.5
Chunky versus chatty ..................................................................................................................... 50
3.7 AGING VAN DATA ..................................................................................................................................... 51
3.7.1
Situering......................................................................................................................................... 51
3.7.2
Enterprise Library – Het Caching Application Block .................................................................... 52
3.7.2.1
3.7.2.2
3.7.2.3
3.7.2.4
3.7.2.5
Opbouw ............................................................................................................................................... 52
“Cacheverloop” (expiration)................................................................................................................ 52
Laden en gebruik van de cache............................................................................................................ 54
Wat opslaan in de cache?..................................................................................................................... 55
Conclusie ............................................................................................................................................. 57
3.7.5.1
3.7.5.2
3.7.5.3
3.7.5.4
3.7.5.5
Introductie............................................................................................................................................ 58
Implementatie van de basisfunctionaliteit............................................................................................ 58
Notificatietransport .............................................................................................................................. 60
Notificatietransport via MSMQ ........................................................................................................... 60
Notificatietransport via .NET Remoting .............................................................................................. 60
3.7.3
3.7.4
3.7.5
3.8
Enterprise Services ........................................................................................................................ 57
Algemene overwegingen tot caching.............................................................................................. 57
SQL Server triggering .................................................................................................................... 58
CONCLUSIE ............................................................................................................................................... 64
ADO.NET 2.0 ....................................................................................................................................................... 65
4.1
4.2
NOOT OMTRENT PERFORMANTIEMETING .................................................................................................. 65
USER DEFINED TYPES .............................................................................................................................. 66
4.2.1
Introductie...................................................................................................................................... 66
4.2.2
Definitie van een UDT ................................................................................................................... 67
4.2.3
Gebruik van methoden ................................................................................................................... 69
4.2.4
Gebruik in ADO.NET 2.0 ............................................................................................................... 70
4.2.5
Overwegingen tot het gebruik van UDT’s...................................................................................... 71
4.2.6
Controle van serializatie ................................................................................................................ 73
4.2.7
Praktisch voorbeeld ....................................................................................................................... 74
4.3 MULTIPLE ACTIVE RESULT SETS (MARS) ............................................................................................... 75
4.3.1
Introductie...................................................................................................................................... 75
4.3.2
Gebruik .......................................................................................................................................... 77
4.3.2.1
4.3.2.2
4.3.2.3
Bulk loading ........................................................................................................................................ 77
Client-side subqueries.......................................................................................................................... 77
Gecombineerd gebruik van queries en DML-operaties........................................................................ 78
4.4.2.1
4.4.2.2
4.4.2.3
Algemene opbouw ............................................................................................................................... 82
SqlDependency.................................................................................................................................... 83
SqlNotificationRequest........................................................................................................................ 84
4.4.3.1
4.4.3.2
4.4.3.3
ICacheItemExpiration interface ........................................................................................................... 86
SqlCacheDependency .......................................................................................................................... 86
Evaluatie .............................................................................................................................................. 89
4.5.2.1
4.5.2.2
4.5.2.3
4.5.2.4
4.5.2.5
4.5.2.6
Eerste testapplicatie ............................................................................................................................. 91
Beta-problematiek................................................................................................................................ 91
Alternatieve oplossing ......................................................................................................................... 92
Uitgevoerde testen ............................................................................................................................... 93
Testresultaten....................................................................................................................................... 94
Impact van de omvang van de tabel..................................................................................................... 95
4.5.5.1
4.5.5.2
SQL Server Profiler ............................................................................................................................. 97
Opmerkingen omtrent de gebruikte betaversie .................................................................................... 98
4.10.2.1
4.10.2.2
4.10.2.3
4.10.2.4
Load-methode .................................................................................................................................... 109
Offline DataReaders .......................................................................................................................... 109
Autonomie voor de klasse DataTable ................................................................................................ 110
Ondersteuning in Visual Studio 2005 ................................................................................................ 110
4.10.3.1
4.10.3.2
4.10.3.3
4.10.3.4
Introductie.......................................................................................................................................... 113
Snellere indexering ............................................................................................................................ 113
Binaire serializatie ............................................................................................................................. 114
Manuele compressie .......................................................................................................................... 120
4.10.3.1
Introductie.......................................................................................................................................... 122
4.3.3
Overwegingen bij gebruik van MARS ............................................................................................ 79
4.3.4
Conclusie........................................................................................................................................ 79
4.4 QUERY NOTIFICATIONS ............................................................................................................................ 80
4.4.1
Introductie...................................................................................................................................... 80
4.4.2
Werking .......................................................................................................................................... 81
4.4.3
Enterprise Library uitbreiding ....................................................................................................... 86
4.4.4
Randopmerkingen .......................................................................................................................... 89
4.5 BATCHED UPDATES .................................................................................................................................. 90
4.5.1
Introductie...................................................................................................................................... 90
4.5.2
Performantietests ........................................................................................................................... 91
4.5.4
4.5.5
Generieke testomgeving ................................................................................................................. 96
Technische achtergrond ................................................................................................................. 97
4.5.6
Conclusie........................................................................................................................................ 98
4.6 ASYNCHRONE DATABASE-INVOCATIE ...................................................................................................... 98
4.6.1
Introductie...................................................................................................................................... 98
4.6.2
Een bekend pattern......................................................................................................................... 99
4.6.3
Gebruik in een Windows Forms-applicatie.................................................................................. 101
4.6.4
Gebruik in een webservice ........................................................................................................... 103
4.6.5
Conclusie...................................................................................................................................... 106
4.7 SYSTEM.DATA.COMMON ....................................................................................................................... 107
4.8 PROMOTABLE TRANSACTIONS................................................................................................................ 108
4.9 SCHEMA DISCOVERY .............................................................................................................................. 108
4.10
DATASET-GERELATEERDE UITBREIDINGEN EN VERBETERINGEN ....................................................... 108
4.10.1 Situering....................................................................................................................................... 108
4.10.2 Algemene verbeteringen............................................................................................................... 109
4.10.3
Verhoogde performantie .............................................................................................................. 113
4.10.4
Samenvoegen van DataSets.......................................................................................................... 122
4.10.3.2
4.10.3.3
4.10.3.4
ADO.NET 2.0-functionaliteit ............................................................................................................ 123
Optimistic concurrency...................................................................................................................... 124
Aging van data................................................................................................................................... 125
4.11
DATA CONTROLS ............................................................................................................................... 125
4.12
CONCLUSIE ........................................................................................................................................ 128
4.12.1 Algemene indruk .......................................................................................................................... 128
4.12.2 Impact op applicatiestructuur ...................................................................................................... 128
4.12.3 Besluit .......................................................................................................................................... 130
SERVICE-ORIENTED ARCHITECTURE (SOA) ........................................................................................ 132
I.1
INTRODUCTIE ......................................................................................................................................... 132
I.1.1
Bruggen bouwen .......................................................................................................................... 132
I.1.2
Basiseigenschappen van SOA ...................................................................................................... 133
I.1.3
Berichtgebaseerde communicatie ................................................................................................ 133
I.1.4
Plaats van de business-logica ...................................................................................................... 134
I.2 WEB SERVICES ENHANCEMENTS ............................................................................................................ 136
I.2.1
Introductie.................................................................................................................................... 136
I.2.2
Configuratie ................................................................................................................................. 138
I.2.3
Features ....................................................................................................................................... 138
I.3
I.4
I.2.3.1
I.2.3.2
I.2.3.3
I.2.3.4
I.2.3.5
I.2.3.6
Beveiliging.............................................................................................................................................. 138
Policy ...................................................................................................................................................... 140
Routing ................................................................................................................................................... 141
Attachments ............................................................................................................................................ 143
SOAP Messaging .................................................................................................................................... 144
Custom filters.......................................................................................................................................... 144
I.3.3.1
I.3.3.2
I.3.3.3
I.3.3.4
I.3.3.5
I.3.3.6
Service front-end..................................................................................................................................... 148
Service logica.......................................................................................................................................... 149
Service back-end..................................................................................................................................... 149
Messaging ............................................................................................................................................... 150
Reliable messaging ................................................................................................................................. 152
WS-Routing en MSMQ .......................................................................................................................... 154
ONTWERPRICHTLIJNEN VOOR SOA ........................................................................................................ 145
I.3.1
Criteria voor service-oriëntatie ................................................................................................... 145
I.3.2
Algemene ontwerprichtlijnen ....................................................................................................... 146
I.3.3
Top-down benadering .................................................................................................................. 148
I.3.4
Mate van loose coupling .............................................................................................................. 154
TOEKOMST VAN SOA............................................................................................................................. 155
I.4.1
Geen hype?................................................................................................................................... 155
I.4.2
Indigo ........................................................................................................................................... 155
SQLXML ............................................................................................................................................................ 158
5.1 INTRODUCTIE ......................................................................................................................................... 158
5.2 STRUCTUUR ............................................................................................................................................ 159
5.3 TEMPLATES ............................................................................................................................................ 160
5.3.1
Inleiding ....................................................................................................................................... 160
5.3.2
Configuratie ................................................................................................................................. 161
5.3.3
Gebruik binnen .NET ................................................................................................................... 163
5.3.4
Eigen middle-tier implementatie .................................................................................................. 164
5.3.5
Performantie ................................................................................................................................ 165
5.3.6
Conclusie...................................................................................................................................... 166
5.4 UPDATEGRAMS....................................................................................................................................... 166
5.4.1
Introductie.................................................................................................................................... 166
5.4.2
Gebruik in .NET ........................................................................................................................... 167
5.4.3
Performantie ................................................................................................................................ 169
5.4.4
Conclusie...................................................................................................................................... 172
5.5 DIFFGRAMS ............................................................................................................................................ 173
5.5.1
Introductie.................................................................................................................................... 173
5.5.2
Gebruik via ADO.NET ................................................................................................................. 174
5.5.3
Performantiemeting ..................................................................................................................... 175
5.5.4
Conclusie...................................................................................................................................... 176
5.6 SQLXML MET SOAP ............................................................................................................................ 177
5.6.1
Configuratie ................................................................................................................................. 177
5.6.2
Gebruik in .NET ........................................................................................................................... 178
5.6.3
Performantie ................................................................................................................................ 179
5.6.4
Conclusie...................................................................................................................................... 180
5.7 CONCLUSIE ............................................................................................................................................. 180
SQL SERVER 2005 WEB SERVICES ............................................................................................................ 182
6.1 INTRODUCTIE ......................................................................................................................................... 182
6.1.1
Http.sys......................................................................................................................................... 182
6.1.2
Alternatief voor TDS? .................................................................................................................. 183
6.2 HTTP ENDPOINTS ................................................................................................................................... 184
6.2.1
Aanmaak van endpoints ............................................................................................................... 184
6.2.2
Beveiliging ................................................................................................................................... 186
6.2.3
.NET clients................................................................................................................................. 188
6.2.4
Performantie ................................................................................................................................ 192
6.3 HTTP SESSIONS...................................................................................................................................... 194
6.4 VERGELIJKING MET SQLXML ............................................................................................................... 195
6.5 CONCLUSIE ............................................................................................................................................. 196
ONTWIKKELING VAN EEN SOAP DATA PROVIDER ........................................................................... 197
7.1 INTRODUCTIE ......................................................................................................................................... 197
7.2 GLOBAAL OVERZICHT ............................................................................................................................ 197
7.3 IMPLEMENTATIE ..................................................................................................................................... 198
7.3.1
SoapConnection ........................................................................................................................... 198
7.3.2
SoapTransaction .......................................................................................................................... 200
7.3.3
SoapCommand ............................................................................................................................. 200
7.3.4
SoapConnector............................................................................................................................. 201
7.3.5
SoapParameter............................................................................................................................. 202
7.3.6
SoapParameterCollection ............................................................................................................ 203
7.3.7
SoapDataAdapter......................................................................................................................... 203
7.4 GEBRUIK ................................................................................................................................................ 204
7.4.1
Webservice ................................................................................................................................... 204
7.4.2
Voorbeeld Windows Forms-client................................................................................................ 204
7.5 EVALUATIE VAN DE GEBODEN IMPLEMENTATIE ..................................................................................... 207
7.5.1
Beperkingen en mogelijke uitbreidingen...................................................................................... 207
7.5.2
Randopmerkingen bij de implementatie ....................................................................................... 211
COM+ COMPONENT SERVICES ................................................................................................................. 214
II.1
INTRODUCTIE..................................................................................................................................... 214
II.1.1 What’s in a name?........................................................................................................................ 214
II.2
BASISCONCEPTEN VOOR COM+ IN .NET .......................................................................................... 215
II.2.1 System.EnterpriseServices ........................................................................................................... 215
II.2.2 Registratie van componenten ....................................................................................................... 216
II.2.3 Declaratieve programmering....................................................................................................... 217
II.3
INTERESSANTE COM+-FEATURES VOOR .NET ONTWIKKELING ........................................................ 218
II.3.1 Object pooling.............................................................................................................................. 218
II.3.2 Just-in-Time activation................................................................................................................. 221
II.3.3 Automatisch transactiebeheer...................................................................................................... 222
II.4
CONCLUSIE ........................................................................................................................................ 226
XML WEB SERVICES..................................................................................................................................... 228
8.1 INTRODUCTIE ......................................................................................................................................... 228
8.2 TECHNOLOGIE ........................................................................................................................................ 228
8.3 ARCHITECTUUR ...................................................................................................................................... 229
8.4 STATUSLOOS .......................................................................................................................................... 233
8.5 TRANSACTIES ......................................................................................................................................... 234
8.5.1
Declaratief model......................................................................................................................... 234
8.5.2
Intra-webservice versus inter-webservice .................................................................................... 235
8.6 OUTPUT CACHING ................................................................................................................................... 235
8.6.1
ASP.NET 1.x................................................................................................................................. 235
8.6.2
ASP.NET 2.0 ................................................................................................................................ 237
8.7 ONE-WAY COMMUNICATION .................................................................................................................. 238
8.7.1
Declaratief model......................................................................................................................... 238
8.7.2
Fire-and-forget............................................................................................................................. 239
8.8 CHUNKY VERSUS CHATTY ...................................................................................................................... 240
8.9 BUSINESS RULES..................................................................................................................................... 242
8.9.1
Situering....................................................................................................................................... 242
8.9.2
Locatie van gegevensvalidatie ..................................................................................................... 242
8.9.3
Excepties ...................................................................................................................................... 243
8.9.4
Inzetbaarheid van de SOAP Data Provider ................................................................................. 245
8.10
ANDERE ASPECTEN BIJ HET GEBRUIK VAN WEBSERVICES .................................................................. 246
8.10.1 Beveiliging ................................................................................................................................... 246
8.10.2 Soap Extensions ........................................................................................................................... 246
8.10.3 Compressie................................................................................................................................... 246
8.10.4 Evolutie ........................................................................................................................................ 246
.NET REMOTING............................................................................................................................................. 247
9.1 INTRODUCTIE ......................................................................................................................................... 247
9.2 ARCHITECTUUR ...................................................................................................................................... 247
9.3 GEBRUIK VOOR SERVICE-APPLICATIES ................................................................................................... 250
9.3.1
Server ........................................................................................................................................... 250
9.3.2
Client............................................................................................................................................ 253
9.3.3
Interface-gebaseerd ontwerp ....................................................................................................... 254
9.4 GEBRUIK VOOR BUSINESS-OBJECTEN ..................................................................................................... 255
9.5 XML WEB SERVICES OF .NET REMOTING? ........................................................................................... 258
9.6 ONTWERPRICHTLIJNEN ........................................................................................................................... 259
9.7 CONCLUSIE ............................................................................................................................................. 260
MSMQ ................................................................................................................................................................ 261
10.1
INTRODUCTIE..................................................................................................................................... 261
10.2
BASISCONCEPTEN .............................................................................................................................. 261
10.3
GEBRUIK IN .NET.............................................................................................................................. 264
10.3.1 System.Messaging ........................................................................................................................ 264
10.3.2 Paden voor wachtrijen ................................................................................................................. 264
10.3.3 Beheer van wachtrijen.................................................................................................................. 265
10.3.4 Verzenden van berichten .............................................................................................................. 266
10.3.5 Ontvangen van berichten ............................................................................................................. 267
10.3.6 Tips voor server-applicaties met MSMQ ..................................................................................... 269
10.3.7 Ontvangsbevestigingen ................................................................................................................ 273
10.3.8 Bidirectionele communicatie........................................................................................................ 274
10.3.9 Gebruik van MSMQ ..................................................................................................................... 274
10.4
SERVICE-GEORIËNTEERD ONTWERP MET MSMQ .............................................................................. 275
10.4.1 Situering....................................................................................................................................... 275
10.4.2 Definitie van een “MSMQ-service”............................................................................................. 276
10.4.3 Workflow voor MSMQ-service ontwikkeling ............................................................................... 279
10.4.4 Opbouw van mqdl.exe .................................................................................................................. 280
10.4.4.1
10.4.4.2
10.4.4.3
Export ................................................................................................................................................ 280
Svcman .............................................................................................................................................. 282
Proxy.................................................................................................................................................. 287
10.4.5 Mogelijke uitbreidingen ............................................................................................................... 288
10.4.6 Gebruik ........................................................................................................................................ 289
10.5
EVOLUTIE .......................................................................................................................................... 290
EAI: EEN BESCHOUWING............................................................................................................................ 291
III.1
INTRODUCTIE..................................................................................................................................... 291
III.2
ONTSTAANSGESCHIEDENIS ................................................................................................................ 291
III.3
TERMINOLOGIE .................................................................................................................................. 292
III.3.1 Identificatie van gegevens ............................................................................................................ 293
III.3.2 Wat integreren?............................................................................................................................ 293
III.3.3 Ontwerpbeslissingen .................................................................................................................... 294
III.4
DE RELATIE SOA-EAI....................................................................................................................... 295
III.5
EEN OVERZICHT VAN INTEGRATIEPATRONEN IN .NET....................................................................... 296
III.5.1
Databaselaag ............................................................................................................................... 296
III.5.1.1
III.5.1.2
III.5.1.3
Pull..................................................................................................................................................... 296
Push ................................................................................................................................................... 298
BizTalk .............................................................................................................................................. 299
III.5.2 Business tier ................................................................................................................................. 299
III.5.3 Presentation layer ........................................................................................................................ 301
III.6
VOORBEREIDING IS DE HELFT VAN HET WERK ................................................................................... 301
CONCLUSIE...................................................................................................................................................... 303
ALGEMENE BESCHOUWING .............................................................................................................................. 303
WAT MET SOA EN EAI? .................................................................................................................................. 303
WAT REST VAN HET KLASSIEKE MODEL? ......................................................................................................... 305
GEBRUIKTE TECHNOLOGIE ............................................................................................................................... 305
NABESCHOUWING ............................................................................................................................................ 307
PERFORMANTIEMETING ONDER .NET FRAMEWORK 2.0 ................................................................ 308
COMEGA EN DE TOEKOMST VAN DE C#-TAAL ................................................................................... 309
B.1
INTRODUCTIE..................................................................................................................................... 309
B.2
DATATOEGANG MET COMEGA ........................................................................................................... 309
B.2.1 SQL Server metadata extractie .................................................................................................... 309
B.2.2 Opvragen van data....................................................................................................................... 311
B.2.3 DML statements ........................................................................................................................... 313
B.2.4 Transacties ................................................................................................................................... 314
B.2.5 Conclusie...................................................................................................................................... 314
COMPRESSIE IN IIS 6.0 ................................................................................................................................. 315
C.1
C.2
C.3
SITUERING ......................................................................................................................................... 315
CONFIGURATIE .................................................................................................................................. 315
KRITISCHE NOOT ............................................................................................................................... 319
REFERENTIES ................................................................................................................................................. 320
Boeken ........................................................................................................................................................ 320
Internet-adressen (eindnoten) .................................................................................................................... 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
*
"
*
*
*
2
*
+
3#A # / *
+
*
+
*
*
'%
"
1
+
*
*
*
*
+
/
(
(
"# *
(
"#
2
1
(
1
1
(+
9 2
*
3#
(
*
L %/
* "
!8!
C",
'%
1
*
,--0
1
*
&#
(
"
5
(
1
*
(
!
& 2
&#
1
/
"
* + '%,---
Figuur 1.2 – Opstelling testnetwerk
,--(--. "
C
# #/C?? &#
,0?
*
*
(
,0-
'%
'%,--0"
;
2C
"
*
Inleiding
!8(
3
11
$
'
*
")
7
*
1
1
C"G8
*
1
%(
(
5"
$O/
using (new Tracer("categorie van de meeting"))
{
//code waarvoor performantiemeting noodzakelijk is
}
Figuur 1.3 – Logging and Instrumentation Application Block (Bron: [8])
*
*
(
Inleiding
12
*
1
1
*
(
L %/ (
*
4
*
%(
(
2
%(
5
*
1
*
%(
%(
*
#
4 #8"
*
(
*
5*
*
%(
"
5
1
2
1
*
(
(
"
*
" $%& !
$%& !
,"-
! "#
(
*
1
*
$
%
%
$
1
$
1
*
%
&!
%
$%& !
!
(
")
")
'
7
/
8
1
"
1
(+
4
(
!88
(
* 1+
+
*
1
*
BPD"
*
+
*
+
")
&$9 1
(
'%
5
7
1
;
*
,"-
*
*
"
+
1
!8/
*
1
*
,"-" ;
")
(
5
"
9 (
1
1
*
(
9 2
,--02
*
*
+
*
*
*
9
( *
*
")
(
(
(
1
/
1
,"-
"3
1
* 1
1
1
*
1
7 '%
"
*
1
,--08"
Inleiding
13
!.
4
;
*
(
21
1
*
*
*
2
1
*
1 1
(
*
(
*
:/
(
1
+
+
1
*
*
/
1
*
*
(
1
"
"
,--0 *
"
"
*
(
*
+2
(
( 5
E
*
* 1+
1
F
1
1
,--0 *
*
1
"
!=
*
(
1
(
1
,
1 *
(
" #
*
*
(
(
*
1
*
9
*
*
1
1
2
1+ "
*
9
(
"
(
1
'%
(
*
* # 3")
,--0
(
1
*
1
() # *
#
C"4
*
# 3")
1 (
1
*
"3
*
*
*
(
*
*
+ (
+
*
(
(+
(
*
*
1
+
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%
*
*
*
1
*
(
*
(
*
1 1 *
+
2
2
$% 1
(
"
#$
$3 /
#$
(( 2
+
*
1
(
*
7 *
1
*
"
1
,
8"
Technologische situering
17
Compilation
Code
Language
Compiler
Native
Code
MSIL
Source
Code
Metadata
JIT
Compiler
Execution
Figuur 2.2 – CLR uitvoeringsmodel
(!=
"
*
'
1
*
$3 /
4
(
(
*
3
1
1
'*
*
+
+
+
*
*
(5
$3 /1
(
(
*
(5
*
*
2
"
(
*
*
1
( 52
"
1
(
(
3
*
" ;
%/
(
1
5
"3
2
")
'
1
*
"
1
" ;
*
( *
* +1
")
1
* 2
(( 2 1
(5 (
1
*
+
*
"H
"
1
1
" 3
"3
(( "
%4&
#$
* +*
(5
#$
*
( A
*
*
(
4
(
1
Technologische situering
(5
18
1
1+
* ";
8
(5
(!B
;
7
2
( *
*
2
"
4
")
1
*
(
/
1 (
2
(!C
2 *
1
*
D
+
2 1
(
1
$3 >/
@
( ,"C *
*
/
2 # !")
/
"
& "
1
$3 /
")
/1
"
Tabel 2.1 – COM versus .NET
Registratie
Metadata maakt een assembly self-describing
GUIDs
Hiërarchische naamruimten (namespaces)
.IDL bestanden
Beschrijving via metadata
HRESULT
Gestructureerde excepties
IUnknown
Moederobject System.Object
AddRef/Release
Garbage collection
CoCreateInstance
OO-ondersteuning en constructoren (“new”)
(!E
,
)
&
*
(
1
0D
(
1
"
*
( *
*
")
*
(
3 7$O82 @
# !")
3 [email protected]
%/
(
1
"
8
@ 3 [email protected]"
3
3 7
*
FG 3 " ;
*
68 (
/
2 1
1
82
(
"
1
*
"
3
*
( *
6 7
+
(
&4 1
*
*
5
!
(
1
(
(
"
Technologische situering
19
3
3
%/
* +
*
3 1
(5 (
(
*
(
3
3
2 *
2
N
2
"
3 1
(
1 (
*
/
3
(
*
#$"
45
(
*
1
"
*
L
(+ (
*
*
/(
# 3")
"
*
*
*
1
1
+* 1
( ! !-
%/
2
55
(
1
"
*
"
+
(
+ "
(
3
*
(
" 4
2
4 " 4 "
2
(--. +
" 4 "
3
*
((
1
*
,
")
1
* 1+
1
BPD"
(-
((!
+
(
1
*
(
+
((
* 1
1
"
( *
1
*
(
*
* (
*
*
(((
/*
*
"
*
")
1
1
")
1
1 *
$%&2
*
,"-
1
?./(
1
"
"
" 7
2
( 1
(
*
*
*
*
( 1
")
/
*
"
*
1
(+
1
Technologische situering
20
1
(
*
2
(
" ;
+
(
*
(
/
/
7"
1
/
(
8
*
"
(
/
(
(
*
1
*
2
(+
*
((
"
((/
(
L %/
/
*
*
":
/
" )
1
(
/
+ (
,--0
(
1
+"
,--0 1
(
/
/
*
*
"
&
(
+
(+
(+
*
# !")
1
(
*
1/
1
(
")
1/
*
1 (
(
"
$
*
2 1 (
1
(
"
"
( ,",
1
*
/
"
Tabel 2.2 – Windows-applicaties versus webapplicaties
Windows-applicaties (“fat clients”)
Webapplicaties (“thin clients”)
+ Vlotte interactie met de gebruiker
+ Eenvoudig browser-gebaseerd model
+ Uitgebreide set van controls
+ Onafhankelijk van het client-platform
+ Toegang tot lokale systeembronnen
+ Gecentraliseerd onderhoud
+ Offline support
+ Geen lokale installatie vereist
- Sterk machineafhankelijk
- Trager door netwerklatentie
- Moeilijke distributie en installatie
- Veel roundtrips naar de server
- Beperkte toegang tot lokale bronnen
- Enkel online ondersteuning
&
*
+
1
(
1
(
"
1
( +1 (
(
"
*
+
+
*
*
*
(
1
(
*
(
1 (
*
(+ (
(
/
"
(
+
Technologische situering
21
*
*
2
7
!
")
$
" ;
1
3
"
$
3
4
7 "
1
+
3
*
*
1
* +
1
C"4
*
78 *
/ (
(
1
" # !")
2
2
2
(+
*
((.
(
((=
*
1+
*
1 (
*
,--0
*
(
2
(
*
*
*
(
+
(
# 3")
*
&
*
(
"; *
* 1+
")
,"- * 1 +
$
7( +
*
(
(
8"
1
1
,"-
1
."
'
$%
")
1
)
6"
+
"
(-
7
*
"
"
* 1
*
2
(
2
N 5
1
1 (
1
*
40
/
*
(
*
1 (
(
*
N
2
# !")
1
2
1
2 1 (
+
*
'%
"
1 (
(
(
*
(
*
*41 *
1
1
*
" 3
,"-
*
(
4
# !")
*
*
(
/
(*
# !")
*
*
(+
4 1
*
*
*
((8
58"
1
1
(
%(
(
" $
(
*
T!
,"- 1
*
1
1
,"-
Technologische situering
22
(/
,
1
"
(
*
+
*
*
*
1 %
%
1
H ,:"
2
(
1
*
7 L
"
(+
(
( #
F
8
(
;
21
7
/
(
(
'%
L %
"
E
1
* 2
)
"
"8
(
*
1
* 8"
(+ /
1
+
" 3
*
1
+ 1
*
1
1
*
"
1
*
"
2
*
*
1
4
*
*
*
@
"
:4"$
(
2
/
%
1
21
+
5
9
3
<
2
2
/
1
1
9
7
1
*
L# %/
/
*
1
H ,/
*
1
L1
%
*
* "
"
*
*
(
1
"
*
* +
*
8"
"
1+
21
+
3# 7 "
1
1
*
2
4
*
")
*
9
*
")
3(+
1
/
1
,"-
1
1
")
")
(
,"-2 1
1
+
"
*
1
$
&
&
( *
/
$O/
1
5
/
+
1 *
#
4
+
";
"
1
*
* "
(
L %2
(
/
Technologische situering
(8
23
0
(8!
*
E
*
F
" 3
(
"
*
*
*
*
*
1
*
/
(
+
E
F*
"
(--/
")
,--G 1
(
*
1
")
1
C"C"
*
"
1
*
UU
*
*
#
K
(
# !")
2
*
")
1
(
(
(
* 1+
(8/
*
(
1
82
*
(
*
1
*
*
1 (
*
F
+
7
9
(
E
+
(
*
1 (
*
*
*
+
1
/
"
4*
1
"
"
(--.
1
(
1 1
1
(8(
*
*
")
+
*
*
1
*
,"-
1
1
(
(
(
3
*
")
1
*
7
3
1
*
1
8M
*
<
+
,"08
+
(
*
*
1
7
,--0"
:"$/2 : 0/2 : $ /
*
" 7
* (
#$
0
M
/
(--.
1
M
"
5
7
2
,"."08"
Technologische situering
24
D
,--0 (
")
E
1
* 5
,"-
F
")
1
C"4/
3
(
+
+";
+
1
(
(
1
1
*
,--0
*
1
/
"
*
*
")
1
,"-
(
'%
*
E 4
1
*
*
")
*
H
*
*
2
(88
1
4*
*
/
7
# !")
7
2
F" ;
2
(
*
$>>
*8
*
7
/
*
(
$O2
1
+*
,--0 1
@O82
*
* +
'%
1 (
*
(
,--0"
8 *
(
The Express products, expanding the Visual Studio product line to include lightweight, easy-to-use, easy-to-learn
tools for hobbyists, and novices who want to build dynamic Windows applications and Web sites.
(8.
(--.
'
1
5
* "
2
(+
*
1
*
"
"
*
/ (
1 (
"$
1
:
*
(+
(
7 "
+"
1+
"
,--0
(
+
"
+
*
*
$
(
(
(
8"
,--0
1
1
+*
1
(
(
"
"H
1
(+
*
1
+
*
*
1
*
*
1
(
=
8
,--0
(
!
*
*
7
(
1
(
*
*
Technologische situering
25
(.
&I ( -
(.!
1
(
1
")
(
$O" ; 1
,--0
1
*
*
*
* 1+
(.(
(
1
*
2
/
1
$O ,"-"
4*
1
"
%
+
N *
2
*
$>>
2
*
*
")
5 "
5 1
*
2
(+
5 *
1
+ (
*
5
7
8
*
(
*
(
";
1
+
List<int> lst = new List<int>();
lst.Add(123);
int i = lst[0];
$O C"-
*
*
(
*
(
5
21
(+
*
1
9
5
ArrayList lst = new ArrayList();
lst.Add(123);
int i = (int) lst[0];
*
7
85
(+
*
(
*
class MyClass<T> : IEnumerable<T>
*
*
public void Add(T val);
public T Get(int index);
2
(
*
*
5
2
Technologische situering
26
1
"
1
'
*
*
9
+
5
public IEnumerator<T> GetEnumerator()
{
for (int i = …; i < …; i++)
yield return …[i];
}
;
1
(
*
/
*
5 7 " "*" (+ 8
+
MyClass<int> lst = new MyClass<int>();
foreach(int i in lst)
{
//...
}
(./
4
+
N *
*
1
$>>" ;
*
+
5
*
E*
"
*
F"
*
(
"
void Main()
{
Thread t = new Thread(new ThreadStart(Do));
t.Start();
}
void Do()
{
//Background thread code
}
$O ,"-
*
1
*
*
void Main()
{
Thread t = new Thread(new ThreadStart(
delegate() {
//Background thread code
}
)
);
t.Start();
}
*
* (
*
(
*
Technologische situering
(.8
!
1
9
+
5
(
'
+*
5
27
*
(
*
1
*
(
/
*
*
5
"H
")
*
*
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
…
}
#endregion
; 1
1
*
1
+ 7* (
1
(
(
";
(+
*
+ 2
+
1
"
(+
,--0
1
(
*
(..
*
8 (
*
( *
)
1
KK
/
*
9
*
"
'
(
5
(
*
(
+
7 "
/1
*
1
*
/*
(
5 "
(
$O C"2
1
8
int a;
a = 0; //onmogelijk null-waarden aan te geven (C# 1.0 problematiek)
int? b;
b = null; //aanduiding van een null-waarde (C# 2.0 nullable types)
#
+
*
(
) &
5
*
4
/1
*
1
Product p1 = null;
Category c1 = p1.Category; //veroorzaakt NullReferenceException
Product? p2 = null;
Category c2 = p2.Category; //c2 wordt null
5
2
Technologische situering
28
(=
$
'
(=!
+
,--0 1
*
E
%(
5F
E
F(
" 3
(
"
(=(
(
2
5 * +
1
*
4*
1
")
"
0
5
*
*
(
1
(
*
<
2
*
*
(
1
(
*
%
(
2
(
%(
5
*
*
"; ( *
"
(
1
(
(
*
2
*
"
@
(
"
1
(
1 (
*
%(
51
1
,"G"
4
%(
5
( 1
* (
1
"
*
1
(
1+
*
,"G 1
H
*
(+
&
*
1
*
*
%(
%(
(=/
"
1
1
*
(
(
*
2
2*
*
E
(
*
%(
*
5$
F/
A
(
"
%(
(
*
"
"
51
(
* "
*
Technologische situering
29
Figuur 2.3 – Basisblokken in Enterprise Library (Bron: [8])
1
1
%(
*
5
*
(
(
1
*
2
" #
2
*
2
3
1
%(
1(
4*
(
1
D
*
%(
+
*
,"-" : (
%(
"
5
"
*
1
(+
+
52
+
*
!
5
((
1 *
*
*
*
1
*
((
";
(
+
*
(
"
")
*
*
")
%(
2
5*
(+
T !
5
K *
1
2
1
,"-"
5
<
")
#!
*
*
Technologische situering
(B
30
#$
(---
(B!
'%
*
,---2
907" 7 "
*
*
*
1
*
+
*
(
5
+ +" '%
*
1
+
1
E +F
(B(
1
*
,---
*
(
1
(
*
1
*
1
*
(
(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
(C8
*
*
";
(
( 1
+
'%
'
*
'%
"
:"$
; 1
*
(
/ '%
*
'%
*
2( +
*
*
1+ "
* (
(
,--0
(+
*
"3
*
/ '%/
1+
1
1
1
1+
(
1
"
Technologische situering
33
00$
*
+
*
*
'%
%
*
3%#!/
/
+
&#
( F
"
*
&&3&/
3 3/
*
E
"
*
*
F
*
"
*
*
*
2
+*
"
(
*
*
"
(
(
+
*
BC-D2 ( " ,C, "*"
(
*
*
1
/ '%
BC-D2 ( " ,G? "*"
(C=
7
((
1
(
*
(
*
9
1
(
* " "# 7
*
(
*
(
(
*
*
'%
*
+
*
*
2 1
*
$
*
*
(
*
7* L
82
'%$%&
*
(
1
(
*
*
=
*
*
1
"
"
"
+ 5
( *
*
*
* ";
(
*
+
(
*
*
*
1
<
(
*
5
"3
(
(
*
*
"H
*
( +(
C-8
*
+
2
;
/
*
1
(
1
& 2 :! #
1
;
1
*
*
1
(
*
)
'% CPPP 1
9JK&4 & /
E
"
+*
2
(
&3!/
"
*
/
/
1
%/
)
$& #
"
'%
'
(
5
((
(
+
/
*
1
(
"
*
(
*
Technologische situering
)
34
# 3&
1
#&
(
7
+
7
1
5
1
"
(
*
(
3
(
7
9 &
*
1
2
1
0
N
1
(
+
21
5
+ 8"
/ '%/
1
1
*
(
N
8
(
*
( *
/
81
(+
(
=
*
21
* +*
1
"
Figuur 2.4 – SQL Server 2005 Service Broker architectuur (Bron: WinNetMag)
*
'%
(
(
(
*
'%
'%
*
1
*
,--0
N 5
"
(
*
(
* 2
'%
/ '%
*
";
* /
(
1
* /
* /
*
*
N *
"
*
*
/
,"- 7
4
*
44
*
# 3")
*
"
"
.8
1
*
1
Technologische situering
(CB
35
1
*
*
+
*
'%
*
+
,--0
'%
7
(
+(
*
8
(
((
2
!$/
"
*
1
*
1
*
(
1
(
)
&
*
*
(
(+
>
*
?/
A
"
*
5
7
1
&
"
(
*
1+
(
8"
(
*
(
H ,/
*
1
9
2$
*
(
*
1
!
<
'-
(
(+
+
*
*
4
*
*
1
F
%
9
*
*
*
5
?"
*
*
(
*
+ '%
"
E
*
*
(
*
*
1
5
'%
1
/8
"
21
/
*
*
"
*
*
*
*
*
1 7
*
"
E
*
(
+"
1 (
(
*
(
E
*
*
*
'%
* 1
*
1
,--0
<
"3
?
F
*
*
(
*
*
,--0" :
1+ ";
(
KK
*
1+
; 1 1
'%
*
1
1
1
>
1
2*
'%
*
*
(CC
,---
1 *
(
44
*
/
G
*
*
(
,--J/,--Q"
+
*
*
*
+
Technologische situering
"
36
*
/5
1
. /(
(
*
"
(CE
4
*
9
*
3#
2
#2
(+
1+
1
*
*
+
1
" '%
*
5
*
*
*
(
*
*
2
(
( C !;
@
(
"
*
*
8"
2
*
8"
*
*
*
+
+
+ *
* /
*
1
1
( +
'%
*
(
*
(
/
L
*
,--0
5
+
+8
1
*
*
*
(
&
*
3
*
,--0
(
1
'7 "
7
*
* 5*
*
*
*
*
((
(
*
*
7
2
1
*
*
1
*
*
(+
2
'%
"; 1
*
(
(
,--0
*
1
+1
'%
*
*
* (
*
*
&
1
"
/
+ *
*
1
I$
*
(
1
(
* +
1
*
*
+2
(
*
2
"
*
(
(
!
"
*
(
*
"#
*
* 1
( <*
"
/
40
!!
/!
(+
(
*
(
*
(
# 3")
(
44
7
*
8
1
/
"
*
'%
"#
*
1+ 2
(
*
(
* 2
5(
(
")
(
E
*
*
1
1
/*
*
1
2 +
F"
ADO.NET is a set of classes that expose data access services to the .NET programmer. ADO.NET provides a
rich set of components for creating distributed, data-sharing applications. It is an integral part of the .NET
Framework, providing access to relational data, XML, and application data. ADO.NET supports a variety of
development needs, including the creation of front-end database clients and middle-tier business-objects used by
applications, tools, languages or Internet browsers. (Bron: [13])
G"C 1
*
1
*
*
# 3")
7
1
'%
"
37
* "
*
(
8
(
*
ADO.NET 1.1
38
Figuur 3.1 – ADO.NET architectuur (Bron: [13])
The DataSet object is central to supporting disconnected, distributed data scenarios with ADO.NET. The
DataSet is a memory-resident representation of data that provides a consistent relational programming model
regardless of the data source. It can be used with multiple and differing data sources, used with XML data, or
used to manage data local to the application. The DataSet represents a complete set of data including related
tables, constraints, and relationships among the tables. (Bron: [13])
H
1
(
*
*
'%/
(
2
(
*
"
7
*
*
#
*
)
"
#
;
& 2* 1+
*
1
*
*
1
*
%
1
+
*
L %
"
1
2
"
*
2 (+
*
1
1+
*
* :! #
*
2
1
%/
1
(+
(
8
4
*
* *
(
*
1 (
*
2
"
ADO.NET 1.1
/(
3
39
%
*
(
;&
")
1
(
/
+
N$
'%
*
5
"
*
(
*
(
# 3")
*
1
(
" N$
*
"
KK *
"
1
;&
1
(
"
(
(
(
+
1
7
'%
(+
(
*
*
1
G".".8"
;
4
=
*
*
1
;&
7
*
1
0
E
1
(
/
*
8"
(
(
'%/
F" $
2
"
;0
1
9
/ (
*
(
N$
7
*
;0
$
% $ /N 5
+
4
1
8" ;
(
N
(
"
*
2:
4(
(
*
$
*
9
*
1
*
N
N$
$
7
$
(
3
$
=
1
(
$
2
8"
(
(+
#
"
*
" #
3%
+2
"
//
*
(
(
N$
*
N$
1
"
*
";
N$
(
*
*
N
#
2
(
*
ADO.NET 1.1
40
string dsn = "server=localhost;uid=usr;pwd=pass;database=mydb";
string query = "SELECT * FROM Products WHERE [email protected]";
//aanmaak connectie, commando en parameterisatie
SqlConnection conn = new SqlConnection(dsn);
SqlCommand cmd = new SqlCommand(query, conn);
cmd.Parameters.Add("@Category", SqlDbType.Int);
cmd.Parameters["@Category"].Value = category;
//ophalen data
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
//gebruik van de reader
conn.Close();
*
(
1
(
+
(
N$
(1
*
"
2 1
/8
40
/8!
7
( *
+
*
*
1
1
*
44
(
(
*
/
*
(
* ) %
(
*
1
(
*
# *
1
'%/
6 (
8"
*
*
'%
*
'%/
*
(
* 1
*
7*
(+
1
"
(
1
*
2
(
*
*
BJD8" 3*
( *
9
"
1
1
'%/
1
(
*
7
"
*
'%/
2
#$
1
*
1
(
1
'%
+
*
5
*
* 1+
1
(
(
(
H
1
*
*
( *
"
"
*
(
'%/
"
1
(+
*
1
*
/
2
*
,--0
+
5/
*
"
*
1
"
ADO.NET 1.1
41
*
(
(
(
( *
(
1
&
*
"
(
(
"
*
*
1/
1
1
*
"
@
1
+
5"""
(
*
2
/8(
*
( *
1/
1
*
1
"""
2
*
(
(+
5/
*
"; (+
1
*
SqlConnection conn = new SqlConnection(dsn);
try
{
conn.Open();
//gebruik van de database
}
catch (SqlException ex)
{
//foutafhandeling
}
finally
{
if (conn.State == ConnectionState.Open)
conn.Close();
}
+
(
1 *
+
"H
(
(
5"""
/(
/8/
>
?
*
(
(
/
2
(
(
1
2*
N$
1
$O/
1
*
<
using(SqlConnection conn = new SqlConnection(dsn))
{
conn.Open();
//gebruik van de database
}
*
"
(
*
+
ADO.NET 1.1
42
(
(+
*
*
(
(+
5"""
1
/
;
";
1
/
5"""
(
/(
(
+
(
/(
*
"
(
")
1
"
( * KK
void Dispose();
#
(+
$O"
(
+
1
*
"
+2
(
*
N$
/
/88
"
")
")
1
1
,"-
(
C"4
(
(
(
*
*
")
")
/
1
"
&
# 3")
N$
*
*
*
*
$
*
*
(
<
9
(
"
1
*
"
(
";
(
*
(
1
N$
*
"
*
"
(
/
/ (+
$
1
(
/(
* *
;
1
*
*
*
";
*
1
*
string dsn = "server=localhost;Integrated Security=SSPI;database=MyDb";
using(SqlConnection conn1 = new SqlConnection(dsn))
{
//gebruik de connectie
}
using(SqlConnection conn2 = new SqlConnection(dsn))
{
//gebruik de connectie
}
+
ADO.NET 1.1
*
43
(
1
7*
1
(
1
2
1
C
1
(
8
(
(+
*
(
*
,
"
"
*
"
1
)
1
" 31
(
&
)
"
1
4
$
7
4
"
*
*
* 1+
*
:
(
(
"
(
*
2
8"
*
21
;
( *
*
"
2
1
*
*
"
SQL Server connection pooling
14
12
Uitvoeringstijd (s)
10
8
Pooling
Geen pooling
6
4
2
0
1
2
3
4
5
6
7
8
9
Aantal connecties
Figuur 3.2 – Performantietesting connectiepooling
+
*
*
1
1
(
1
(+
*
1
*
N 51
(
*
":
ADO.NET 1.1
44
( +
(
*
( <*
4
1
71
2
2
"
1
+8
string dsn = "server=localhost;uid=…;pwd=…;database=…;pooling=false";
+
(
*
1
";
44
8
*
(
*
( *
*
")
'%
*
*
1
!
!
7*
'%V&
5
*
1"
/.
;
(
*
*
'%/
*
N$
+2
*
'%/
1
*
*
4
/
*
(
(
"#
+
*
(
1
+"
"
*
(
(
4
( *
1
*
"
M
+*
1
3
(
*
1
/
" ; 1
2
1
1
*
1
2
*
(
* "
Tabel 3.1 – Performantie directe SQL-statements versus stored procedures
2
0
C
,
G
#$
.".,-???
-"--GC.J
-"--,.G,
-"--P.Q0
-"--GG.,
-"--,,Q.
"
"
ADO.NET 1.1
;
45
*
*
*
*
*
1
(
/=
(
1
*
+
(
2
*
*
0
/=!
0
G"G 1
*
*
"
2*
*
7
44 *
@
1
"3
+
"
0
/ (+
*
( *
1
1
M0
*
(+
N
(
*
(+
(
*
9
*
*
1
:
+"
+
(+
'%/
(+
*
1
*
"
" ;
*
*
* "
Figuur 3.3 – Het DataSet-objectmodel (Bron: [13])
8"
1
ADO.NET 1.1
46
*
(
*
"
+
" ;
*
(
(
1
*
*
+
7
1
*
12 * 1 +
N
(
2
2
#
1 1
BCD ( " CQP"
*
*
8"
(
*
3
.
+
1+
%/
*
8
*
N$
(
7
0
*
*
*
*
2
+
(
*
"
3
.
/
/
*
Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the
resolution of concurrency problems. (Bron: [1])
;
+
1+
*
*
*
5/
(
#
(
(+
1
*
W
1
" ;
*
*
7
G"?".8"
/=(
K *
*
*
1
*
/ (
"H
'%
* /
+
1
*
E
*
3
F
/ /
*
( 2 * 1
*
;
1
"
(+
N$
*
/
N
#
1
(
1
/=/
*
+
(
''
N
#
(
(
(
'%/
2
0
*
1
55
"
55
(
1
2
"
''
+
N$
"
5
*
2
(+
(
*
*
(
*
*
*
(+
5
ADO.NET 1.1
47
+"
+
*
*
55
4 " 4
(
*
5
1
"
( !
1
"
(
( *
"
1
: 0/(
*
5
"
"
( "
55
(
+
*
DataSet ds = …;
DataRow row = ds.Tables["Products"].Rows.FindById(id);
string name = (string) row ["ProductName"];
;
+
+
5 4* 1
5
(
"
55
+
*
*
( *
*
5 E (+ F 1
*
MyDataSet ds = …;
ProductsRow row = ds.Products.Rows.FindByProductId(id);
string name = row.ProductName;
+
5
*
*
+
* 2
(+
(
(
*
*
+ ( *
*
*
*
"
+ (
(
MyDataSet ds = new MyDataSet;
foreach (MyDataSet.Products.ProductsRow row in ds.Products)
{
string name = row.ProductName;
//etc
}
55
+
1
(
*
*
1
(
(
E* 1F
"
(
1
(
+ (
* 1 *
1
*
(
(
*
*
*
(
"
5 5
((
"
55
(
5
"
/
3
(
5
*
55
(+
1
2
(
+
*
(
*
"
(
"
ADO.NET 1.1
48
1
1
*
* *
(
55
2
1
(
1
(
*
* 4 " 4 "
/=8
'
/
5/
*
5
(
1
" 3
*
5/
(
*
+
+
1
*
I ; ( +(
+
A +
1
1+
"H
+
*
(
3
(
(
*
*
1
+
*
*
*
(
1+
1
(
(+
"
*
*
+(
1
1
+"
1
*
*
(
( +
* "
1
*
2
(
2*
I
*
+(
"
(
(+
(+
2
1
"
BCD ( " .C0 "*"
I#
$
$
'
I#
$
'
;
(
/
# 3")
!
(
"
!
"
1
:! #
*
UPDATE Products
SET [email protected], [email protected], …
WHERE [email protected] AND [email protected] AND [email protected] AND …
/
ADO.NET 1.1
;
49
( *
; & /
+
*
1
1+
*
2 1
*
"
*
5/
;
1
(
R3= 1 +
(
*
1
07&
/
(+
2
1
"
1+
08"
* 8 :! #
5*
1
1
7
7
1
"
' 3
+ (
(+
*
*
/
*
UPDATE Products
SET [email protected], [email protected], …
WHERE [email protected]
*
*
(
*
*
*
*
*
*
(
"
*
/*
+
" ; :! #
1
1
+
(
/
*
(+
+
2
"3
*
'%
1
*
*
*
+
(+
1+
*
*
UPDATE Products
SET [email protected], [email protected], …
WHERE [email protected] AND [email protected]
#
(
*
*
*
*
2
:! #
*
UPDATE Products
SET [email protected], [email protected], …, Version=Version + 1
WHERE [email protected] AND [email protected]
(
:! #
#
1
/
(
1
1
*
1+
1
1
*
1
2
"
*
*
"
*
*
* "
(+
/
ADO.NET 1.1
/=.
;
&
(
*
50
'
'
*
*
1
*
*
*
7
*
*
*
7
82 1
"
*
+
(
*
%/
;0
*
*
4
N$
7
+*
*
/
" # 3")
,"- (
9
*
*
"3
(
(
1
*
1
"
.8"
*
(
(
(
*
*
*
2 (+
*
*
(
*
Q8"
+
*
*
KK
1
1 (
*
"
*
/
1
/
*
private void btnGetData_Click(object sender, System.EventArgs e)
{
//Achtergrond-thread starten
new Thread(new ThreadStart(GetData)).Start();
}
private void GetData()
{
//Gebruik van gegenereerde code
sqlDataAdapter1.Fill(myDataSet1);
//Overschakelen naar Windows Forms thread
this.Invoke(DisplayData);
}
private void DisplayData()
{
//Gebruik resultaat in myDataSet1
}
*
(
*
( + +
(
+
*
*
(
(
1
/
1
1
*
1
+ +
"
"
"3
2
(
5
(
1
+
*
*
+
(
*
ADO.NET 1.1
51
(
1
*
((
# 3")
7
/B
C"4/
'
"
+
(
*
*
# 3")
7
8*
,"-
1
."?8"
4
/B!
+
/
*
(
)
*
*
+ *
(
2 *
"
*
*
5/
+ +"
1
# 3")
+ *
1
(
1
*
C"4
1+
+ 2
*
*
1+
*
N
( +1
#
"
0
*
"
";
*
:
N
1
*
1
"
*
1
(+
1
(+
(
1
5
( +"
*
*
/
( +N
*
"
"
3*
" K
1
(
1
%(
(
1
*
1
"
*
2 (+
*
*
"
*
#
*
*
*
*
(+
"
*
(
(
(
:
*
+
+
9
5
#
8*
*
*
N
7
(
1+
" 3
"
1
/
1
(
+
*
1
#
5/
*
*
1+
(
"
*
(
1
( *
1
1
(
( *
( * "3
(
2
1+
ADO.NET 1.1
52
(
(
1
*
*
*
"
*
(
$
*
1+
1
/B(
"
7
(
# 3")
,"-
*
."C-".8"
'N
&
4
1*
!
7
/B(!
G". 1
(
BQD *
8"
&
"
(
*
1
;
+
*
1
5
+*
*
"
/
(
*
7
*
*
1
+ *
"
7
*
*
7
/B((
7
*
<
"
*
1 G
"
*
&
1
( *
82
(
>&
?5 3
6
*
(
*
*
1
(
"
+
((
"3
*
(
* 1+
"
(
*
*
CacheManager cache = CacheFactory.GetCacheManager();
cache.Add(
id,
obj,
CacheItemPriority.Normal,
null,
new SlidingTime(TimeSpan.FromMinutes(5))
);
*
7
";
8
(
ADO.NET 1.1
53
Figuur 3.4 – Caching Application Block (Bron: [8])
;
7 (+
81
*
* 1+
(
7 8"
1
(+
1
1
2
"
*
2
*
(
2
ADO.NET 1.1
(
*
54
1
&
9
8"
(
3
/ (+
4
";
+
*
#
"
*
(
1
(+
1
*
;
(
" (
2
(+
7
(
*
0
1
9
2 1
*
*
*
4
(+
( +
"
*
* 1+
"
(
1
/
1
1
*
*
(
*
"
*
*
21
"
/
1
* 1+
1
+
*
4 $
1
(
" H
* 1+
1
"
/B(/
$
;
2
*
&
(+
1
(
*
*
#
1
(
" 1
*
;
*
*
(
*
(+
( *
" #
"
*
* 2*
(
+
*
" )
* (
1
1
1
+
(+
*
(
*
2
;
+
* (
*
1
+*
(
2
9 *
+
"
'
) &
"
+
*
*
"
*
"
"
*
*
*
2 1
1
*
21
*
"
ADO.NET 1.1
55
MyClass obj;
if (CacheManager.Contains(key))
obj = (MyClass) CacheManager.GetData(key);
else
//ophalen van het item en opslag in de cache met Add
/B(8
H
L
*
*
(
+
*
3
*
*
@
2(+
*
0
"
*
*
(
1
1
" 1
(
*
2
KK *
(
"H
1
5
*
"
"
(
#
(
*
KK
1
*
/
(
(
/
(
;
*
5 !
1
*
:/
+
(+ *
*
*
1
(
1
(
2
*
1
+
3
*
1
1
(+
(
*
"
*
StronglyTypedDataSet ds;
if (CacheManager.Contains("ds"))
ds = (StronglyTypedDataSet) CacheManager.GetData("ds");
else
{
sqlDataAdapter.Fill(ds);
CacheManager.Add("ds", ds, priority, refresh, policy);
}
1
(+
*
52
5
(
:2
1
1 *
(
1
+
1
(+
*
1 *
"
*
"
1
*
*
"
*
"3
2
ADO.NET 1.1
56
sqlDataAdapter.Fill(ds);
CacheManager.Add("ds", ds, priority, refresh, policy);
5
52 1
(
*
1 *
$
1
!
5"
(
+
*
AbsoluteTime policy = new AbsoluteTime(TimeSpan.FromMinutes(5));
MyRefreshAction refresh = new MyRefreshAction(sqlDataAdapter, ds);
;
5&
#
*
class MyRefreshAction : ICacheItemRefreshAction
{
private SqlDataAdapter _adap;
private DataSet _ds;
public MyRefreshAction(SqlDataAdapter adap, DataSet ds)
{
_adap = adap;
_ds = ds;
}
public void Refresh(string key, object val, CacheItemRemovedReason r)
{
if (r == CacheItemRemovedReason.Expired)
_adap.Fill(_ds); //OPGELET: wijzigingen gaan verloren
}
}
;
(+
N
#
*
(
1
+
(
,"-
1
(
(
(
1
*
*
(
*
1
."."G8"
(
(
1
+
/ (+
*
(
"
2*
/
(
*
"3
5
1
7
*
*
(+
1
* *
*
2
1
7
2
1
1+
*
( +*
1
1
:/
1
"
1
# 3")
*
: *
"
*
"
(
*
1
1+
2
"
*
ADO.NET 1.1
/B(.
&
(
(
57
*
*
!
(+
%(
(
%(
*
"
5
5
+
*
*
"!
1+
*
*
*
2
+"
/B/
#
*
( *
(
9
(
*
*
$3 >
; (+
";
(+ "
(+
*
/
1
+ *
1
"
(
7
*
$3 >
*
/
*
*
*
*
*
(
+
*
$3 >
(+
8
1
*
")
1
/1
* (
1+
/B8
;
"
4
(
*
*
*
"
5
(
1 (
*
*
1 *
(
*
(+
( 1
*
N
1
+
(
*
'
"
+
*
*
*
1+
1
1
1
*
2
+ +"
+
*
1
+ "
*
* *
"H
N
* 1
* 1
#
* 1
1
1
*
*
(
"
*
1
7
*
1
*
+
5/
'
8 N
(
(
7
1
8
+
*
"
*
1
ADO.NET 1.1
6
58
2
(
*
*
1
1 (
1
*
5 *
+ +
(+
(
" #
44*
/B.
*
7
*
(
(+
1
8"
+
1
4 1
*
1
# !")
,"-
1
1
"
#$
/B.!
(
1
1
; (+
*
*
;
1
1+
1
# 3")
1
* *
'
*
'%
1+
(+
(+
/ (
*
"
1
# 3")
1
*
(
*
(
*
"
*
*
1
*
1
1
(
"
,"- (
(
2
C"4
(
2
(
* $3 >"
/B.(
C #
*
* 1
*
1
"
*
*
1
/ '%
%/
(
*
CREATE TRIGGER trigger_name ON table FOR INSERT, UPDATE, DELETE AS
BEGIN
EXEC SP_Notify
END
, #
*
1
*
CREATE PROCEDURE SP_Notify AS
DECLARE @Handle INT
E !V)
1
*
5F
"
ADO.NET 1.1
59
DECLARE @Return INT
DECLARE @str VARCHAR(200)
EXEC @return = sp_OACreate ‘Sample.SqlEvents.Notificator’, @Handle OUTPUT
IF (@return = 0)
BEGIN
EXEC @return = sp_OAMethod @Handle, ‘Notify’, @str OUTPUT
EXEC @return = sp_OADestroy @Handle
END
*
(+ (
*
5
"; *
V3#
(
*
* *
)
(+
*
G #
")
5
"
" N *
"
1
1
1
$3 / (+
(5
)
(
")
*
*
1
$3
"
(5
*
(5
)
)
(
1
1
1 * *
1
)
9
"
(
*
using System.EnterpriseServices;
namespace Sample.SqlEvents
{
public interface INotificator
{
void Notify();
}
public class Notificator : INotificator, ServicedComponent
{
public Notificator() { }
public void Notify()
{
//aan te vullen
}
}
}
*
1+
)
$3 >" 3
( 52
)
5
1 *
(
"
1
/
1
1
1
#
*
(5
"
7
" 4
#
*
( 56 5
82
ADO.NET 1.1
60
(
( +$3 > *
* " 4 A
( 5" "
/B./
*
)
*
"
*
(
1
2
"
7
*
H
"
" "#/1
+
"
1
(+
"
9
*
/5
*
2*
"
'*
(
*
*
(
" ; ( +1
KK 1
1
*
"
<
*
'* 1+
/B..
*
+
*
1
1
1
*
+ *
1
*
"
C-"
9
*
")
<
&
( 1
/
*
((
. )
;
*
'
" "#
(
(
(
,
2
1
/B.8
;
*
:)$/
8
* 1
21
(
(
0
+
*
*
(
(
1+
1
(
1
(
(
1
(
+
*
*
+
*
1
5"
(
*
(
"; (+
"
(+
*
1
*
*
)
* /
1
2
*
ADO.NET 1.1
61
using System;
using System.Collections;
using System.EnterpriseServices;
namespace Sample.SqlEvents
{
public interface INotificatorServer
{
event NotificationEventHandler NotificationEvent;
void SendNotification();
}
public class NotificationEventArgs : System.EventArgs
{
public NotificationEventArgs() { }
}
public class NotificatorServer : INotificatorServer,ServicedComponent
{
public NotificatorServer() { }
//event voor clients
public event NotificationEventHandler NotificationEvent;
public void SendNotification()
{
NotificationEventArgs args = new NotificationEventArgs();
//overloop alle clients
Delegate[] inv = NotificationEvent.GetInvocationList();
IEnumerator ie = inv.GetEnumerator();
while (ie.MoveNext())
{
NotificationEventHandler h =
(NotificationEventHandler) ie.Current;
try
{
//signaleer event
IAsyncResult ar =
h.BeginInvoke(this, args, null, null);
}
catch
{
//client onbereikbaar
NotificationEvent -= h;
}
}
}
public override object InitializeLifetimeService()
{
//levensduur singleton object oneindig lang
return null;
}
}
}
)
1
(
*
*
)
*
"
*
/
(
*
ADO.NET 1.1
62
+
'%
* 21
1+
(+
1
1
*
V3#$
(+
/
2
*
E
1
/
8"
/
1
"
/
1
*
*
E
45F *
/
7( +
*
(
F( * *
//registratie type, URI en singleton modus
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(NotificatorServer),
"Notificator",
WellKnownObjectMode.Singleton
);
ChannelServices.RegisterChannel(new HttpChannel(4321));
;
*
4
7
*
'%
KK
)
*
* 8
7 " (
1
7*
/
*
/
8
;
*
1
";
!/
)
(
1
8"
*
.G,C"
/
)
)
)
(
5* ")
&
*
public void Notify()
{
HttpChannel ch = new HttpChannel(0);
ChannelServices.RegisterChannel(ch);
RemotingConfiguration.RegisterWellKnownClientType(
typeof(NotificatorServer),
"http://server:4321/Notificator"
);
InotificatorServer srv =
(INotificatorServer) new NotificatorServer();
srv.SendNotification();
}
1
)
*
(
(
*
*
( *
1+
)
1
*
1+
1
5
)
(
( * "
#
1
/
*
2 (+
*
*
(
"
1
5
ADO.NET 1.1
63
public void Notify(string table)
{
…
srv.SendNotification(table);
public void SendNotification(string table)
{
NotificationEventArgs args = new NotificationEventArgs();
args.Table = table;
…
…
EXEC @return = sp_OAMethod @Handle, ‘Notify’, ‘table’, @str OUTPUT
…
0 : (
(
*
1
/
*
/
(
* +
*
(
"
")
&
*
*
*
(
*
*
*
(+
(
{
HttpChannel ch = new HttpChannel(0);
ChannelServices.RegisterChannel(ch);
RemotingConfiguration.RegisterWellKnownClientType(
typeof(NotificatorServer),
"http://localhost:4321/Notificator"
);
INotificatorServer srv =
(INotificatorServer) new NotificatorServer();
srv.NotificationEvent += new NotificationEventHandler(Notify);
}
public void Notify(object sender, NotificationEventArgs e)
{
//aan te vullen
}
.
1 (+
(
* (
*
7
+
'%$%& 7
*
# 3")
(+
(
,"Q"?8"
'%
,"Q",8"
,"*
'%
;
*
1
*
,--0
(
*
,--02
'
(
(
* 1
*
1
ADO.NET 1.1
/C
64
&
2
$ +
1
+
*
*
1
/
# 3")
9
(
*
/
/
*
*
9
,"-
*
"
2
7 3#8" )
"3
*
"
"
*
1
1
*
(
8
+
# 3")
*
#
(+
/
+
*
7*
*
*
"
*
1 *
(
/
# 3")
*
2
/
1
1
*
+
# 3")
8
40
(-
(
*
# 3")
# 3")
1
C"C"
*
.",2 ."G
,"-
1
(
* (
.". (
'%
* (
# 3")
*
*
# 3")
1
,--0"
,"-
1
,"-
(
*
*
"
8!
1
%(
(
5
# 3")
(
%(
5
7
#
*
1
4 #8" # *
*
*
+(
")
E
1
F
(
*
# 3")
using (SqlConnection conn = new SqlConnection(dsn))
{
conn.Open();
//inschakelen van “connection statistics”
conn.StatisticsEnabled = true;
//gebruik de connectie hier
…
//opvragen van de statistieken
HashTable stats = conn.RetrieveStatistics();
//weergave van de statistieken
foreach(object o in stats)
{
DictionaryEntry e = (DictionaryEntry) o;
Console.WriteLine("{0}:\t{1}", e.Key, e.Value);
}
65
(
*
1
,"-2
*
}
(
*
"
(
";
,"- 1
*
*
N$
*
5
/
,"-
(
4
*
*
%(
*
(
ADO.NET 2.0
66
*
*
+
*
) 1
(
*
) 1
5 &
*
*
$
4
* 2 5
*
2
2$
=
2
* &
M
:
4
M
2 !
4
2
"
*
1
*
4
(
//voorbeeld
stats["ConnectionTime"];
# 3")
,"-
*
$ *
*
1
1
8(
(
2
1
(
0
" ;
*
"
'
8(!
:
5
7
:
=8*
E +
(
*
( "
1
(
(
=2
+
:
"
*
/*
(
*
1
(
*
*
*
(
7
(
5/*
*
(
:! #
4
*
(
(
*
5
5 " H
*
"
"
*
*
(
/
(+ 2
*
'%
*
5
1
5
*
*
5
2
*
(
:
,"Q",8" ;
(
KK
5"
*
(
,--0
1
+
5 (
(5
*
1
=
/
'%
F
*
1
:
*
(+
% $
(
4
5
(
2
1
"
*
2
ADO.NET 2.0
8((
67
0
3
20
:
")
1
5
"
+
*
*
7
(5
/
'%
'%
*
8
+
*
+:
*
(
" N
5
"
*
2
" N 5 2
;2
"
(
0
*
' 4
(
*
*
"
1
"# *
"
,--0
"
:
5
,--0
,--0 (
*
*
*
5 *
1
"
2
+
(
") *
[SqlUserDefinedAttribute(Format.Native)]
struct Point { … }
5
)
[Serializable]
[SqlUserDefinedAttribute(Format.Native)]
struct Point { … }
*
"
(
+
(
*
*
*
(
(
*
((
*
*
2
$O ,"7
*
D
(
;
$ '
"
+ 1
(
*
()
(
# 3")
C"4 *
8
(
5 )
"
*
1
1
(
( 1
1
*
/1
(
(
*
*
5 F7 "
/1
1
$ '
/
(
,"0"082
1
*
E1
/1
"
*
5
(
+ *
*
5
(
2
*
# 3")
,"-
*
5) "
(
:
"
+
(
E
F
ADO.NET 2.0
68
[Serializable]
[SqlUserDefinedAttribute(Format.Native)]
struct Point : INullable
{
private bool _isNull;
public readonly bool IsNull
{
get
{
return _isNull;
}
}
public static Point Null
{
get
{
Point p = new Point();
p._isNull = true;
return _isNull;
}
}
}
*
!
*
2
*
*
*
*
2*
" 3
*
+
1
+
[Serializable]
[SqlUserDefinedAttribute(Format.Native)]
struct Point : INullable
{
public Point()
{ … }
public readonly bool IsNull
{ … }
public static Point Null
{ … }
public override string ToString()
{ … }
public static Point Parse(string val)
{ … }
}
)
*
*
,--02
'%/
*
+
= I
(
*
5
(+
+
$& #
(
:
#
(
")
%S
$& #
/
*
(
5
7:
(
"
I
+
S!
/
82
(
ADO.NET 2.0
69
1
! / W
L
*
S"
+
1
'%/
*
:
%
1
+
SELECT coord.X, coord.Y FROM Map WHERE City='Brussels'
UPDATE Map SET coord.X = 12345 WHERE City='Ghent'
*
*
(
1
*
*
5
5
'%
;,
4
'
*
")
2
)
; '
/5 "
*
2!
0
2
(
2
4 %
2
(
public SqlInt X
{
[return: SqlFacet(IsNullable=false)]
get { return _x; }
}
'%/
2
(
4
(
5
:
" ;
7
*
1
*
)$ 2
/*
7'
1
+
*
1
*
(5
*
+8"
+"
8(/
%
/*
1
*
(
* *
9
(
1
*
"
*
*
1
'%
*
public double DistanceTo(Point p)
{
return Math.Sqrt(_x * p.X + _y * p.Y);
}
;
1
+
N 5
*
+
*
SELECT m1.coord AS p1, m2.coord AS p2 FROM Map m1, Map m2
WHERE p1.DistanceTo(p2) < 10
*
(
1
ADO.NET 2.0
+
70
*
(
*
9
7*
"
*
"H
8
(
(+
*
'%
*
(
+
,--0
*
*
1+
3
21
1
1
"#
*
0
"
' 4
21
*
21
( +* 1
1
*
%
*
0
(
/1
8(8
+
"
*
;2
(
(
*
*
*
1
N
&
;"
40
(-
(
(
(
:
"
*
*
N 5
*
1
SELECT City, coord FROM Map WHERE Country='BE'
;
1
N
*
&
:
!
*
"
1
*
/
5 ";
/
*
5
+
+ ( *
Point p = (Point) reader[1]; //1 is de index van de kolom
;
(
*
5 *
*
(+
55
+
( *
1
1+ (+
=
/3
*
#
+ (
7 3#82
* (
"
5
*
"
*
5
4 " 4
1
*
"
(
*
L
/
*
*
ADO.NET 2.0
71
8(.
20 O
#
1
*
(+
:
<
A
*
*
/
1
For data to be considered as a UDT, it should be a scalar object (bron: [16] blz. 196).
*
1
(
@ "
KK
*
+ (+ 1
1
* 2
+1
"
+
*
(
E
F *
(
4(
*
5
"
(
1
1
"
*
E
1
F" ;
1
*
BC?D 1
E
*
(
*
F7
5
$
*
8"
"
3
+(
* +
(
*
":
")
(
(
=
+
*
*
/5
1
*
*
(+
E*
*
5 F
1
(
1
*
=
1
2
7 %3 = 8
"3
(
*
*
*
( *
1
(
+
*
<
(
(
:
(
2
"
(
*
*
*
*
+ "#
5
1
Regel 1: Rijke business-objecten dienen niet als UDT gedefinieerd te worden.
'%
*
(+ /
9
1
"
F2 E
*
"
(+ *
(
E
1
+2
(
*
(
F2 E
/
(+
F2
2
4
KK
1
(
E +(
*
/ (+ F (
"#
*
1
"
(+
5
(
ADO.NET 2.0
#
72
1
1
*
*
1
:
=
KK
:
5 1
(
*
1 1
"
5 5
KK
+
(
5
+
Regel 2: Een UDT moet kunnen beschouwd worden als één geheel, waarbij de individuele attributen
binnen het type geen relationele rol spelen binnen de databank.
(
(
1
:
5 "
5 "H
1
(
(
1
*
*
1K
+
"
Regel 3: De operaties op een UDT dienen enkel in te werken op de data van het UDT zelf of een
relationeel verband tussen verschillende instanties van het UDT uit te drukken.
1
*
9
*
*
(
(
1+
*
(
E
*
:
1
*
2
+"
(
( 8
/
N
(
+
4
*
7
((
KK :
(
* "#
(
+ +
*
9
+
F (
*
";
KK :
9
(
:
(
* (
:
*
" ;
+
(
+
*
#
/:
1K
*
*
*
1
+"
Regel 4: Enkel types waar een sterke cohesie tussen de velden bestaat, komen in aanmerking als UDT.
Artificiële UDT’s dienen ten stelligste vermeden te worden.
1
(
+
*
*
:
*
KK
+
(
* (
1
2
"
Stelling: Eenmaal een UDT gedefinieerd werd, blijft de data binnen het UDT (in de praktijk) steeds
met elkaar in verband. Kunstmatige associaties van data dient men te vermijden omdat deze door de
definitie van een UDT een permanent karakter krijgen.
ADO.NET 2.0
*
:
*
1
+
* *
="
1
73
*
9
*
:
* 1+
(
E
"
+(+
"H
*
*
+
*
*
(
(
1
*
1
*
=
*
(
3
'F/
4
/
(+
1
(
*
+
*
*
*
*
E(
F"
Stelling: Filtering van gegevens dient steeds zo dicht mogelijk bij de opgeslagen data te gebeuren.
Indien UDT’s dit in de hand kunnen werken, rekening houdende met alle voorafgaande regels, dient
dit de ontwerpkeuze voor het gebruik van een UDT positief te beïnvloeden.
8(=
+
&
)
(
*
*
'
44*
*
2 1
75
8 (
*
:
,
2
*
5
";
/
2
(
+
* +
5
*
*
1
*
(
7
1
'%
* ";
21
( *
(
'%
*
*
*
)
*
(
*
,
:
"
( *
(
*
*
9
"
*
*
*
+
5&
( <*
*
"
2
*
,--0
+
*
'
21
*
*
1
(
(
*
(
2
(
*
2
*
*
*
0
7
&
(
8 '%
*
"
* 1+
,--0/
"
1
:
=
ADO.NET 2.0
8(B
74
1
5
*
(
*
*
2
F*
1
1
*
2 ( 2
:
2
*
*
2
2
(
*
2
"
E
*
(
*
9
*
1+(+
:
*
*
*
";
+ 5
[Serializable]
[SqlUserDefinedAttribute(Format.Native)]
struct Address : INullable
{
private string _street;
private int _number;
private string _zip;
private string _city;
public Address(string street, int number, string zip, string city)
{ … }
//properties voor get/set van attributen
…
//implementatie van INullable en statische property Null
…
public override string ToString()
{
string f = "{0};{1};{2};{3}";
return String.Format(f, _street, _number, _zip, _city);
}
public static Address Parse(string val)
{
string[] p = val.Split(';');
return new Address(p[0], int.Parse(p[1]), p[2], p[3]);
}
}
;
(
*
:
( *
+
*
1
*
:
(
*
*
21
1+
2
:
(
(+
:/
1
(
*
*
* "
1
(
1 "
*
1
*
(
(
1
*
(
+
(
(+
(
:
*
*
(
5
"
" N2
+
"
*
(
ADO.NET 2.0
'%
*
(
75
,--0"
*
(
*
*
+ (
(
+ 5
(
(
/ (+
(
1
3 1
/
#
(
:
5 /
(5
"
(
/ (+
"
"
*
(
(
(
'%
(
5
(
7( +
*
/ (+ 2
(
(
* 1 (
(
(
1
:
:
"
(
*
9
"
1
8"
+
*
*
" ;
/
1
+1
4
,--0
*
1
#
/
*
5
/
*
#
(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/
ADO.NET 2.0
78
4
7
1
*
1
(+
8 (+
2
*
1
using (SqlConnection conn = new SqlConnection(dsn))
{
SqlCommand cmdCat = new SqlCommand(sqlCat, conn);
SqlCommand cmdProd = new SqlCommand(sqlProd, conn);
cmdProd.Parameters.Add("@Category", SqlDbType.Int);
conn.Open();
using (SqlDataReader cat = cmdCat.ExecuteReader())
{
while (cat.Read())
{
CategoryNode node = new CategoryNode(cat["ID"] as int);
node.Name = cat["Name"] as string;
tree.Nodes.Add(node);
cmdProd.Parameters["@Category"].Value = (int) cat["ID"];
using (SqlDataReader prod = cmdProd.ExecuteReader())
{
while (prod.Read())
{
ProductNode node2
= new ProductNode(prod["ID"] as int);
node2.Name = prod["Name"] as string;
node.Nodes.Add(node2);
}
}
}
}
}
;
(
!
*
#& (
" 4
N$
&
7
7
*
78" H
*
#&
+ +*
$ 8
7
/
8
8
(
1
*
(
*
(
*
L %/
"
L %
8/(/
E
%
*
;
*
(
*
1
"
1 +N
( *
*
1
1
"
'%L %/N
9
+
F
*
1
"
0"$*
1
( *
*
#&
(
(
*
*
"H
*
*
N$
*
%/
(
"
+
*
ADO.NET 2.0
79
*
(
(
*
3
&
21
71
C
#$
8//
/
*
@
#&
1
(
5
* *
*
"
%/
= (
(
*
1
*
1
*
+
I
% $ /
*
*
* "
8"
"49
1
(
*
I
(
1
8/8
&
#&
* ";
*
*
+
*
+
+ * (
(
'%
*
1
# * &
(
*
#&
1
,"-
(
1
1
*
1
/
"
(
*
(
* 1
1
7
*
*
+
Atomicity, Consistency, Isolation, Durability
#&
KK
*
(+
*
*
4
1
*
(
1
,--0/
7 " G".8
2 (
*
" ;
1
*
4
1
"
(
"
"
X
# 3")
"H
#&
*
*
*
4
*
#&
#& ( +
(
(
*
(
*
*
2
*
*
#& /
N
+1
1
*
KK
%/( 1
*
"
;
+1+
3
'/
8
"
44 4
*
#&
"
1
* /
*
1
ADO.NET 2.0
80
Though in many situations MARS may provide an alternative to server-side cursors and provide performance
improvements, it is not a replacement for cursors. (…) In a nutshell, MARS is a programming model
enhancement that allows multiple requests to interleave in the server. Though it does not imply parallel
execution in the server, it may yield some performance benefits if used correctly.
1
1
*
'%
*
"49
1
(+
*
&
*
+
1
(
*
;
*
*
+N
"
/
#&
$
*
K +
1
( +*
( 1
2 (+
*
(
#&
* 1
1
*
*
1
+
2*
+ "
*
"
*
#
2
"
(
88
(
#& /
(
2
(
,--0/
1
1
(
,"-
2
#& /
2
*
1
*
*
"
# 3")
*
'%
1
2
*
(
/ '%
7( +
*
N
2
'%
( *
*
*
,--02
4
'%$%&/
(
8"
'
88!
(+
(
*
* *
1
@
*
(
3
(+
(
*
2
G"J8"
:
"$
/
*
1+
5/
*
*
(
#
'
2
1
*
8"
*
*
+
(+
(
" #
"#
/
*
*
7 "
(+
*
(
7 "
*
(
1
2
I(+
*
(
ADO.NET 2.0
81
(
(
I
+
/
(
+7
*
( +
*
(
(
5
1
*
/
*
(
*
5
"; 1
1
+"
*
(( 2 ( +
+*
1
1 KK
8"
(
(
+
(+
+
"
(
*
*
'
1
21
(
*
object + tijdsstempel = object in cache
#
2
(+
* *
"
2
(+
*
* 1+
4
+ 5
2
1
(
* *
'%
*
*
*
7
*
88(
;
1
7
5
+
E
F82 1
*
1
8"
(
(
,"- 1
'
2
(
1+
# 3")
1
8"
1
1
*
*
*
"
H
(
1
*
'%
# !")
*
,"-
*
Q8" ;
*
/
1+
1
"
C"4 7
(
G"J"08"
1
1
"
*
*
7( +
*
(
1
# !")
(+
C"4
1
(
*
# 3")
+
N 5
(
1
(
*
*
'%
E N$
5F
(
,--0 7
*
J
+1 +
(
1
*
*
5/
*
N 5 *
N 51
1+
*
'%
2
(
*
# !")
(
/
"
1
+
(
"
,---
ADO.NET 2.0
88(!
82
4
; (
*
5
C"
# 3")
*
(
,"
(
'%
*
*
*
5
1
,--0"
*
*
'
*
1+
*
1
*
1+
1
*
(+
"
*
*
*
"
'%
;
G"
*
;&
5
(+
,"-
"
7
+
7
,"Q"?8 *
*
*
"
." #
+*
1
5
*
*
( +
*
5
*
"
."G 1
+1
* "
Figuur 4.3 – Werking van query notifications in SQL Server 2005 en ADO.NET 2.0 (Bron: MSDN)
*
(
(
'%
(
*
*
*
(
+
5
(
*
,---
N 5 *
9
1+
'%
*
3
(
* 17
KK
(
* 1
*
2 *
(
1
< 4
'%
*
*
< 4
"3
* 1
,---
8
"
(
1
*
1
+
1+
ADO.NET 2.0
83
*
5
'%
(
*
,--0
# 3")
5
3
*
*
'%
5
1
*
88((
;0
"
,"-2
* 1
*
+2
*
(+
(
*
*
"
N
444
*
(
"
'
5 * +
1
,"-" ;
*
(
*
+
N
# 3")
";
(
2
*
1
*
<
*
1
*
5
*
*
*
/
(
private void Do()
{
//Initialisatie, gebruik en sluiten (!) van de connectie
using (SqlConnection conn = new SqlConnection(dsn))
{
SqlCommand cmd = new SqlCommand(query, conn);
//aanhechting van SqlDependency en notification event handler
SqlDependency d = new SqlDependency(cmd);
d.OnChanged += new OnChangedEventHandler(ReceiveNotification);
conn.Open();
//gebruik van de connectie
…
}
}
private void ReceiveNotification(object sender,
SqlNotificationEventArgs e)
{
if (e.Type == SqlNotificationType.Change)
{
//opnieuw bevragen en aanvragen van query notification
//bijvoorbeeld door oproep van Do()
}
}
*
+
*
1
KK
*
(
*
1
+
" ;
!
,
1
*
,--G *
"
'%
+
*
1
1
*
*
"
+ (
*
*
1 L!
;
! *
ADO.NET 2.0
84
"57
1
"
?"C"C8"
+
1
88(/
;
*
N)
*
*
* 1
&N
/
*
1
N
5"
2
(
(
5
1+
" ;
( +
* "
= 1
+
*
/(
" ;
1
9
$!/
9 ;
1
*
5
'
(
(
2 +
*
1
(+
*
1
*
N
1+
+
+
$
+
<
5
+
"
(
*
(
"
"
* 1
"
(
*
5
/
ALTER DATABASE SET ENABLE_BROKER
GO
CREATE QUEUE notification
CREATE SERVICE svc ON QUEUE notification
([http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification])
GO
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO …
GO
#
(+
(
(
*
*
*
N
/ (
*
5
2
*
private SqlConnection conn;
private void Init()
{
//connectie blijft openstaan
conn = new SqlConnection(dsn);
conn.Open();
(
1
(+
N$
*
N)
"
&N
ADO.NET 2.0
85
Do();
WaitForChanges();
}
private void Do()
{
using (SqlCommand cmd = new SqlCommand(query, conn))
{
//creatie van een SqlNotificationRequest en aanhechting
SqlNotificationRequest nr = new SqlNotificationRequest();
nr.Id = new Guid();
nr.Service = "svc";
nr.Timeout = 0;
cmd.Notification = not;
//uitvoering query
…
}
}
private void WaitForChanges()
{
string wait = "WAITFOR (RECEIVE CONVERT(xml, message_body) " +
"FROM notifications)";
using (SqlCommand cmd = new SqlCommand(wait, conn))
{
//wacht en ontvang notification
cmd.ExecuteScalar();
//verwerk notification, bijvoorbeeld door vernieuwen van cache
…
}
}
(
*
1
(
/
(
"
1 *
*
7*
8
5
" 5
+
(
*
'%
*
5
"
" N/
* 2
1+
1
'%
*
1
*
"
<
*
" N$
1
2
&N
" N2
/
+ *
/
"
"
"
( 1
((
N)
5
*
" N
(
,--0
1
1
(
";
*
*
( *
,--0 $%&/
(
*
:
'%$%& 7
(
(
(
=2
8"
ADO.NET 2.0
86
88/
$
+
7
'
*
*
G"J8 *
1
+
*
1
*
(
*
(
"3
%(
(
,"-
1
*
(
*
88/!
5*
1
*
1
3
"
5(
+ "
(
2
1+
(
( + 8"
5"$
" 4
*
'78 1
*
*
*
(
2
*
1
8
(
*
*
(
G
M
M
*
$
$
*
!
"
0
2
"
7
1
( +1 +
*
+
*
;&
1
*
( +1 +
*
G"J", (
(+
1
1
*
*
*
81
"
'
*
+
*
%(
4
1
88/(
")
(
78
) 7$
1
%(
*
$
*
1
*
3
(
+
+"
5
,"-/
"!
%(
2
*
!
&
1
1
+7
( +
*
5
5
*
(+ *
")
(
1
*
%(
C"4
"
1+
1
# 3")
%(
/
*
*
!
1
*
(
N$
* 1+
5/
"
ADO.NET 2.0
87
* 1
# !")
,"- 1
%(
N$
*
5"
1
%
<
1
5/
2
1
1
1
1
%(
1 (
*
1
+
5"
(
*
*
*
1
private CacheManager cm;
private SqlConnection conn;
public void Init()
{
cm = CacheFactory.GetCacheManager();
conn = new SqlConnection(dsn);
conn.Open();
}
public MyDataSet GetData()
{
MyDataSet ds = cm.GetData("ds") as MyDataSet;
if (ds == null)
{
ds = new MyDataSet();
SqlCommand cmd = new SqlCommand(query, conn);
SqlDataAdapter adap = new SqlDataAdapter(cmd);
adap.Fill(ds);
SqlCacheDependency dep = new SqlCacheDependency(cmd,
"notification", "svc");
cm.Add("ds", ds, CacheItemPriority.Normal, null, dep);
}
return ds;
}
+
*
*
*
*
*
1
(
#
2
8"
/
2
*
$
1
*
*
1
"
+
&
#
7 "
( +
1
1
*
interface ICacheItemRefreshAction
{
void Refresh(string key, object item, CacheItemRemovedReason reason);
}
ADO.NET 2.0
88
*
N$
5( *
+
1 1
*
(
3
+
N$
+
*
1
1
1
(
( *
*
1
1+
1
8"
$
* 1+
1
N
7
*
/
1
4
/ (+
"
#
3&/
5
1
* ;
4
class SqlCacheDependency : ICacheItemExpiration
{
private bool expired = false;
private SqlCommand cmd;
private string queue;
private string waitfor =
"WAITFOR (RECEIVE CONVERT(xml, message_body) FROM {0})";
public SqlCacheDependency(SqlCommand cmd, string queue, string svc)
{
this.cmd = cmd;
this.queue = queue;
SqlNotificationRequest nr = new SqlNotificationRequest();
nr.Id = new Guid();
nr.Service = svc;
nr.Timeout = 0;
cmd.Notification = nr;
new Thread(new ThreadStart(Monitor)).Start();
}
public void Monitor()
{
string wait = String.Format(waitfor, queue);
using (SqlCommand mon = new SqlCommand(wait))
{
cmd.ExecuteScalar();
expired = true;
}
}
public bool HasExpired()
{
return expired;
}
public void Initialize(CacheItem item) {}
public void Notify() {}
}
ADO.NET 2.0
89
+
$
&
1
*
*
1
*
#
B
*
+
*
( D
(
(
*
1
"
(
!
(+
*
%(
+
5"
88//
( +# 3")
%(
C"4
5*
1
*
*
* *
(
"
*
*
*
*
(
"
*
888
;
(
*
+ I
*
1
1
(
(
*
(+
(
*
"
9
*
5
(+
(
*
* *
(
5
5
" '%
*
(
*
,--0
1
1
(
"
*
(
"
1
*
N
5
*
*
*
1
*
*
(
1
"
@
(
+ (
5
* *
1
(
1
2
"
+
(
*
1+
*
+
"
*
(
*
"
*
1
/
' 8"
*
* 1
#
7 ;
(
(+
2
N)
*
(
*
*
'%
*
5 5
1
*
1
*
+
* 1
+
+
(+
(
5
F *
7( +
*
*
(
*
51
I
+
/
E
%(
8 1
*
5 +
*
(
!
*
(
%(
(
(
*
*
5
*
1
(
1
*
ADO.NET 2.0
*
90
*
21
*
"
+
1
1
*
( *
+
(
*
+
*
'
" $
N
(
*
(
5
1
(
*
(
(
*
1
*
*
* *
(
%(
(+
* 1+
*
+
$3 >/
$
"3
8.
2
"
*
(+
*
(
+
* *
+
*
*
(
7*
(
" 4 /
(
5
8
1 1
(
"
1
1
*
*
*
$3 >
"
7
8.!
+
(
*
# 3")
(
C"C
"
G 1
#
/
(
*
*
1
*
5
"
1
4
+
*
( 1
%/
7)
& 2 :! #
1+
KK *
KK *
1+
+
(
KK
2
%
(
((
(
*
)
*
1
* 1
1
"
* 21
*
7
8"
1
*
*
/
#
1+
*
2
0
(+
1
+
*
*
1+
(+
(
1
*
* "
1
(+
*
"
N
" # 3")
*
#
/
,"-
1
*
5
1
#$
(--.
"
ADO.NET 2.0
8.(
91
1
8.(!
(
+ *
(
*
KK (
*
1
( 2
N
G0
N
";
$
*
/
*
N
#
0--- +
(+
"
(
*
7
"
*
G
( 1
1
5 5
1
*
*
/ (
82
#
*
*
2
2
(
1
( 1
1
*
public void Load()
{
sqlDataAdapter1.Fill(dataSet11);
}
public void Alter()
{
foreach(DataSet1.ClientRow row in dataSet11.Client.Rows)
{
string zip = row.ZIP.TrimStart('e');
char[] z = zip.ToCharArray();
Array.Reverse(z);
row.ZIP = new String(z);
}
}
public Hashtable Update(int size)
{
sqlConnection1.ResetStatistics();
sqlDataAdapter1.UpdateBatchSize = size;
sqlDataAdapter1.Update(dataSet11);
return (Hashtable) sqlConnection1.RetrieveStatistics();
}
#
/
H !/
*
+
1
*
*
# 3")
8.((
+
*
"
,"-
7
(
(
:
(
/
"
1
(
+
1
7
."C8
"
*
1
*
# 3")
1
,"-
(
" H
( +
/
/
ADO.NET 2.0
92
,--0 ( +
*
(
(
+
";
(
N$
N
/
*
*
#
/
4
When batching, the command's UpdatedRowSource property value of
UpdateRowSource.FirstReturnedRecord or UpdateRowSource.Both is invalid.
(
1
*
# 3")
(
444
1
(+
*
" ;
=
(
*
N
# 3")
7
* *
+
* (
*
(
*
*
(
8
"
,"- 1
9
#
(
"
# 3")
(+ (
4
*
(+
(
2!
"
1
*
$
(
*
8.(/
! (
* *
1
1
( *
*
((
*
+
")
1
%/
1
,"- (
*
1
)
1
& A:! #
/ 4
A
";
2
;&
%
/
(
,--G
*
/
(
"
7
2
N
*
#
*
private string query = "SELECT * FROM Client";
public void Load()
{
using (SqlDataAdapter adap = new SqlDataAdapter(query, sqlConnection1))
{
adap.Fill(dataSet11);
}
}
public void Alter()
{
foreach(DataSet1.ClientRow row in dataSet11.Client.Rows)
{
char[] z = row.ZIP.ToCharArray();
Array.Reverse(z);
row.ZIP = new String(z);
}
}
/
ADO.NET 2.0
93
public Hashtable Update(int size)
{
sqlConnection1.ResetStatistics();
using (SqlDataAdapter adap = new SqlDataAdapter(query, sqlConnection1))
{
adap.UpdateBatchSize = size;
SqlCommandBuilder b = new SqlCommandBuilder(adap);
adap.Update(dataSet11.Client);
}
return (Hashtable)sqlConnection1.RetrieveStatistics();
}
1
*
21
*
1
1
*
(
."0","0 1
*
1
* "
N$
=
%/
+
:! #
" ; ( +1
/
2
1
7
8.(8
(
# 3")
,"-
1
(
# 3")
'%
*
1
+
*
+
=
+
*
+
(
Y8
(
1
1
*
*
*
1
*
*
1
"
+
1
*
"
+
=2
/
*
(
"
-2 1
KK (
1
,2 G2 .2 02 C-2 C02 ,-2 ,0
(
(
7
+
5
*
(
(
(
C2 1
C"4
*
71
1
*
,---
(
+
*
*
G"?".8"
1
(
"
2
*
*
5 (
*
Session Provider:Connection has been closed by peer
*
1
8"
1
ADO.NET 2.0
94
8.(.
(
*
1
*
1
(
(
1
(+
*
*
"
Tabel 4.1 – Meetresultaten voor verschillende batchgrootten
Grootte
batch
Time (ms)
Buffers (bytes)
NetworkServer Execution Connection
Sent Received
Roundtrips
Server
1
77040
80906
85603
5483
5484
5483
2
74987
76860
85923
5483
2743
2742
3
70561
72444
81367
5484
1830
1829
4
70651
72844
84421
4113
1373
1372
5
77992
80015
91181
4387
1099
1098
10
88997
90860
102367
3291
551
550
15
104279
106793
119321
3291
368
367
20
118089
120082
133221
3291
277
276
25
145278
147191
160630
3291
222
221
1
*
(
*
C/0
1
*
Performantiemeting batched updates
100000
90000
80000
70000
ms
60000
NetworkServerTime
50000
ExecutionTime
ConnectionTime
40000
30000
20000
10000
0
1
2
3
4
5
Batchgrootte
Figuur 4.4 – Performantiemeting batched updates
:
*
( +
(+
(
/2
/
1
+
= "#
+*
*
(
(
(
*
( 2
*
*
G Z.
*
ADO.NET 2.0
1
95
(
( +
*
*
+
*
(
1
1
(
*
*
( +
+ 7
,
1
+ "; 1
*
+
*
*
(
"
* 8
( *
2
*
(
*
444
7
"
1
8
Executing an extremely large batch could negatively affect performance. Therefore, you should test for the
optimum batch size setting before implementing your application.
8.(=
+
*
* 1
(
*
1
(
(
*
*
# 3")
,"-
"
(
*
(
1
*
*
2
!
#
$
# 3")
K
( "
*
$
,"- *
";
*
1
(
1
(
*
*
string dsn = "server=sql2005;uid=…;pwd=…;database=gandagas";
string query = "SELECT [Name 1], Location, ZIP, VAT FROM Client";
using (SqlConnection conn = new SqlConnection(dsn))
{
DataTable tbl = new DataTable("Client");
SqlDataAdapter adap = new SqlDataAdapter(query, conn);
adap.Fill(tbl);
using (SqlBulkCopy cp = new SqlBulkCopy(dsn))
{
cp.DestinationTableName = "CompactClient";
cp.ColumnMappings.Add("Name 1", "Name 1");
cp.ColumnMappings.Add("Location", "Location");
cp.ColumnMappings.Add("ZIP", "ZIP");
cp.ColumnMappings.Add("VAT", "VAT");
conn.Open();
cp.WriteToServer(tbl);
}
}
3
1 *
1
2
8" )
1
*
1
."0"
(
+ *
(
*
7
*
2
ADO.NET 2.0
96
Performantiemeting batched updates
70000
60000
50000
40000
ms
NetworkServerTime
ExecutionTime
ConnectionTime
30000
20000
10000
0
1
2
5
10
20
50
100
200
250
Batchgrootte
Figuur 4.5 – Performantiemeting batched updates
1
(+
*
(
(
*
(
* *
# 3")
*
(
1
(+
8.8
%
)
5 *
,2
*
2 1
*
(
1 (+
*
1
"
*
,
"
1
+
(
*
*
(
*
C"4
*
(
(
*
3
class BatchedUpdatePerformanceTester
{
private SqlConnection conn;
private SqlDataAdapter adap;
private DataSet ds;
public BatchedUpdatePerformanceTester(string dsn, string query)
{
conn = new SqlConnection(dsn);
conn.StatisticsEnabled = true;
*
"
ADO.NET 2.0
97
adap = new SqlDataAdapter(query, conn);
SqlCommandBuilder b = new SqlCommandBuilder(adap);
ds = new DataSet();
conn.Open();
ds.Fill(adap);
conn.Close();
}
public HashTable Test(int batchSize)
{
foreach(DataRow row in ds.Tables[0].Rows)
row.SetModified();
adap.UpdateBatchSize = batchSize;
conn.Open();
adap.Update(ds.Tables[0]);
conn.Close();
return (Hashtable)conn.RetrieveStatistics();
}
}
8..
8..!
#$
1
<
1
*
'%
*
,--0 !
*
2
1
(
(
*
*
Figuur 4.6 – SQL Server Profiler trace voor batched updates
ADO.NET 2.0
3
98
*
*
&!$
(
/ *
*
1
F3
2
7896
9
!
(
;/ *
6
2
(
KK
*+
1
"
+
*
(
1
*
)""" ) /(
"
*
( *
8
N$
*
1
* "
8..(
*
(
(
;
C
*
(
'%
*
*
1
(
N/
/(
/(
*
*
*
'%
*
,--0
(---
(
7
((
*
2 1
"
# 3")
,"-
KK (
1
(+
* 1
(
*
1
(
*
*
(
58
"
( +
/
(
J-
1+
*
*
(
N
/ ( 2
8.=
*
3
=
,Q"
(
(
"
*
*
V4
*
1
(
$
,--0
*
(
1+
*
4
1
1
(
+ *
"
&
+
(
*
(
1
(
"
*
1
*
8=
*
*
*
4'
*
*
*
(
1
"
*
8=!
1
(
(
*
5
(
*
1+
1
* "
(
1
"3
+
# 3")
C"4/
ADO.NET 2.0
99
5
*
/
*
# 3")
*
*
*
21
+
,"-
'%
*
*
(
5
,--0
*
*
*
*
*
"
(
J
2
,---"
8=(
3
*
*
")
1
5
1
"""
*
I
(+ 5
/
"3
2
(
(+
# 3")
1 (
*
(
+
1
'
F/
I
(
N$
"
*
1
2
"
+ (
7
*
,"-
5
*
E
*
N$
5
1
*
"
(
1
81
(
(+
*
*
SqlConnection conn = new SqlConnection(dsn);
IAsyncResult result = conn.BeginOpen();
while (!result.IsCompleted);
conn.EndOpen(result);
*
1
(
1
*
# 3")
C"4 (
"
1
1
*
1
(
8" H
+
/
*
*
*
*
*
*
5
+
5/1
"
1
1
/
(
*
7
/
*
public void Start()
{
SqlConnection conn = new SqlConnection(dsn);
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open(); //synchroon
IAsyncResult result = cmd.BeginExecuteReader(
*
2
"
" ; ( +1
1
*
ADO.NET 2.0
100
new AsyncCallback(Finished),
null,
CommandBehavior.CloseConnection
); //asynchroon
}
public void Finished(IAsyncResult result)
{
//connectie wordt automatisch gesloten door de CommandBehavior
SqlDataReader reader = conn.EndExecuteReader(result);
}
( *
*
4
"
*
*
+
*
*
1
5
"
4
1
1
*
(
4 '*
KK
1
1
1
*
*
9
5
2
1
*
5
/
2
*
* 1
*
1
"
2
*
/
"
*
=
(+
2
= 1
*
*
*
(
+
1
1
*
+
";
(
"
1
*
(
(
(
*
1
KK
71
7
N 5( +
( *
+
"
2
*
(
*
*
8
8"
*
/
+
=
*UU
*
(
(+ * 1
*
"
1
(
"
* 1
*
(
*
KK
( +5
(+
*
2 *
*
* 1
H
*
*
"
*
*
(
1
(+
(
1
1
";
*
"
$
=
*
1
2
"
+(
/(
N
1
1
*
1 (
H
1
" ; (+1
*
H
( 51
*
'
#5 &
5"""
1
=
*
1
1
2
1
*
(
1
"
ADO.NET 2.0
;
101
(
*
*
IAsyncResult result1 = …; //asynchrone invocatie
IAsyncResult result2 = …; //asynchrone invocatie
//Keuze 1: WaitOne
result1.AsyncWaitHandle.WaitOne(); //wacht op result1
//Keuze 2: WaitAll
WaitHandle handles[] = new WaitHandle[2];
handles[0] = result1.AsyncWaitHandle;
handles[1] = result2.AsyncWaitHandle;
WaitHandle.WaitAll(handles); //wacht op result1 en result2
//Keuze 3: WaitAny
WaitHandle[] handles = new WaitHandle[2];
handles[0] = result1.AsyncWaitHandle;
handles[1] = result2.AsyncWaitHandle;
for (int i = 0; i < 2; i++)
{
int j = WaitHandle.WaitAny(handles); //wacht op result1 of result2
//verwerk resultaat van de aanroep (op basis van j)
}
1
4
*
1
* 1
*
1
5
1
(
1
1
1
2
4
1
(
*
(
*
'%
( *
KK
( *
*
" 3
(
*
1 7
8
"H
,
(
(+
" ; ( +*
:/
1
H
1
( *
/
"
%
*
*
"
1
8=/
*
H
*
,---/
*
+
(
/
")
1
( +*
1
(
/
71
21
(
*
delegate void MyDatabindingHandler(SqlDataReader reader);
void BeginRetrieveData()
{
…
cmd.BeginExecuteReader(
new AsyncCallback(EndRetrieveData),
5
2
/
*
(
,"-
"
(
*
:/
ADO.NET 2.0
102
cmd,
CommandBehavior.CloseConnection
); //asynchrone invocatie met callback
…
}
void EndRetrieveData(IAsyncResult res)
{
SqlCommand cmd = (SqlCommand) res.AsyncState;
SqlDataReader reader = cmd.EndExecuteReader(res);
//weergave data via UI-thread
this.Invoke(new MyDatabindingHandler(ShowData), reader);
}
void ShowData(SqlDataReader reader)
{
//weergave data
}
/
*
private void btn_Click(object sender, EventArgs e)
{
//bw is een instantie van BackgroundWorker
//en heeft twee eventhandlers: DoWork en RunWorkerCompleted
bw.RunWorkerAsync();
}
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
//Uitvoering binnen aparte draad
using (SqlConnection conn = new SqlConnection(dsn))
{
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
//doorgave resultaat
e.Result = cmd.ExecuteReader();
}
}
private void bw_RunWorkerCompleted( object sender,
RunWorkerCompletedEventArgs e)
{
SqlDataReader res = (SqlDataReader) e.Result;
//weergave data via UI draad
}
1
*
" ;
5
(
*
"
1+ (+ *
*
KK
5
(
*
ADO.NET 2.0
103
1
/
*
9
1
"
" #
*
=
+
*
H
4 '/
"
(
1
tsynchroon(cmds) = t(cmd1) + t(cmd2) + … + t(cmdn)
tasynchroon(cmds) = max{t(cmd1), t(cmd2), ..., t(cmdn)} + c
+5
*
*
1
(
(
*
=
1
*
*
2
+ "
*
+ 5
( *
5
8
1
"
1
*
2
1
;
*
5
8=8
75
(
*
+
5
(
*
*
*
*
1
*
."G".
#&
*
(
"H
*
(
" ;
"
#&
* " !
1
*
KK
*
( *
(
1
(
<
(
*
1
1
*
*
"3
2*
+ (
1
+ +
*
*
*
+
*
* *
11
*
* 1
*
*
"
*
((
+
(
5
*
"
%
#
1 (
(
*
(
N
+
*
(
*
* 1
/
+
1 (
1
*
L/
'
*
1
*
+
(
1
*
!8
*
*
L/
;
"
"
;
7 " 3#! *
/
*
+
A
<
(
45
"
KK
ADO.NET 2.0
104
(
*
*
(+
*
*
*
L/
*
1
*
*
(
5
/
"
H '1
1
*
1 (
(
*
(
1
*
*
1 (
I
")
;
&
+
*
*
(
*
2 $3 >2
(
*
*
4 /
"
(
*
*
(
1
*
*
*
# !")
5
2 (+
*
*
(
N
(
*
"
5
H
*
"
(
'2
! ,-,/
1
I
2
;
* 1
*
*
1
"
D8" ;
( +
* 1
2
B
/
1
*
1
*
7*
(+
*
L/
KK
N
+
2
1 (
"$
1
1 (
1
( +1
*
*
private gandagasDataSet RetrieveDataAsynchronously()
{
string dsn1 = "server=sql2000;uid=…;pwd=…;database=gandagas;" +
"Asynchronous Processing=true";
string dsn2 = "server=sql2005;uid=…;pwd=…;database=gandagas;" +
"Asynchronous Processing=true";
gandagasDataSet ds = new gandagasDataSet();
using (SqlConnection conn1 = new SqlConnection(dsn1),
conn2 = new SqlConnection(dsn2))
{
IAsyncResult[] res = new IAsyncResult[2];
WaitHandle[] wait = new WaitHandle[2];
SqlCommand cmd1 = new SqlCommand("SELECT * FROM Client", conn1);
SqlCommand cmd2 = new SqlCommand("SELECT * FROM Invoice", conn2);
conn1.Open();
res[0] = cmd1.BeginExecuteReader();
wait[0] = res[0].AsyncWaitHandle;
conn2.Open();
res[1] = cmd2.BeginExecuteReader();
wait[1] = res[1].AsyncWaitHandle;
WaitHandle.WaitAll(wait);
SqlDataReader reader1 = cmd1.EndExecuteReader(res[0]);
ADO.NET 2.0
105
ds.Client.Load(reader1);
SqlDataReader reader2 = cmd2.EndExecuteReader(res[1]);
ds.Invoice.Load(reader2);
}
return ds;
}
(
7
0
55
8
*
/
*
5
5 E
F
,--0
( *
*
1
3
1
+ * 1
E1
F(
7
."CC8"
*
'%,---
(
*
(
*
1
*
1
(
(
'%,--0 7
C"."C8"
*
*
*
7
#
4 #8
public gandagasDataSet RetrieveDataSet(out decimal s)
{
long start, stop;
QueryPerformanceCounter(out start);
gandagasDataSet ds = RetrieveDataAsynchronously();
QueryPerformanceCounter(out stop);
s = GetSecondsElapsed(start, stop);
return ds;
}
+ *
5
*
*
(
L 8
+*
1
CQ"GJ
*
"
N
*
"
J-
7
*
1
1
(
*
private gandagasDataSet RetrieveDataSynchronously()
{
string dsn1 = "server=sql2000;uid=…;pwd=…;database=gandagas";
string dsn2 = "server=sql2005;uid=…;pwd=…;database=gandagas";
gandagasDataSet ds = new gandagasDataSet();
using (SqlConnection conn = new SqlConnection(dsn1))
{
SqlCommand cmd = new SqlCommand("SELECT * FROM Client", conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
ds.Client.Load(reader);
}
using (SqlConnection conn = new SqlConnection(dsn2))
{
SqlCommand cmd = new SqlCommand("SELECT * FROM Invoice", conn);
*
ADO.NET 2.0
106
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
ds.Invoice.Load(reader);
}
return ds;
}
1
1+ *
*
*
*
*
N
G- [
*
(
(
C-- [
*
7
*
+*
5
*
*
*
1
1
8=.
*
1
*
( <*
(
71
+
*
*
*
*
*
"
1
*
,--0"
1
*
( +1
(
(
1
8"
1
+(
(
*
*
*
"
*
*
1
(+
"
2 (+
(
*
1
(
1
1+
1
1
=
1
H
*
4 /
+
2 (+
*
*
*
( *
"
1
(
(
+
1
5
*
&
9
(
(
(
+
*
1
*
*
2
"
C"."C8 1
+*
,0"Q,
5*
*
;
5
(
'
(
(+
5
/ *
/
";
# /1
*
1 (
5
*
"
+
*
+"
(
1
2
ADO.NET 2.0
8B
;
107
'
0
&
*
%(
(
5
"
(
(
*
1
1+
" # 3")
"$
"3
/#! 1
*
1
*
*
(
(
(
,"-
*
*
*
*
+
(
*
*
5
"
(
*
*
(
*
*
+"
(
(
*
(
#! *
'%
* /
(
string provider = "System.Data.SqlClient";
DbProviderFactory f = DbProviderFactories.GetFactory(provider);
DbConnection conn = f.CreateConnection(…);
…
DbCommand cmd = f.CreateCommand(…);
…
*
* 1+
(
*
(
1
*
# 3")
0 &
1
(
*
1
1
(! *
!
$
5/
*
*
5$
+
*
(+
*
*
$
A1
/
(
*
((
!
*
*
%(
1
5
*
# 3")
,"-/
!
*
"
$
*
(
"
'
*
I
*
*
"
5
#
*
"
I
*
*
*
7
*
(! *
,"-"
*
*
*
(
*
L %(
( +"
*
ADO.NET 2.0
8C
108
1
# 3")
,"-
*
*
"
+
*
$
*
( +
(
+
*
8E
(
7
# 3")
# ";
N$
*
2
*
($
(
=2
"
# 3")
(
*
*
*
*
% $ /
*
5/
*
+7
2
"
,"-
(
(
/ (+
+
2:
(
0
/
*
1
/( *
(
8 !-
(
(
4 2
*
"
"
*
*
"
*
(
"
2 1
2* 1 2
2 1
1
1
,"-
8
1
(
*
'
(
*
*
"G"G *
0
1
(
*
*
(
/* 1 8"
*
8 !-!
*
(
(
*
*
(
# 3")
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#
E0
(+
(
"
*
#
1 (
( +( +
*
1
+
2
*
*
21
*
1
'%
(
*
1
/
."J"
Figuur 4.7 – Strongly typed DataSet voor de Gandagas-database
3
*
,--0 *
+
+
*
*
(
*
( * +
*
(
(
/
*
1
ADO.NET 2.0
112
<gandagas.dbo.Price>
Error
in
SELECT
clause
expression
near
‘PERCENT’.
Unable to parse query text.
+1
(
*
*
*
55
* 1
1
2
")
1
"
*
*
1
" K *
*
,--G
( *
8
"H
*
+
( 1
*
L
E
* 1
"
(
*
(
*
(+
N *
/
* 1
F
( #
7
*
(+
1
."Q" #
*
*
"
1
1
*
(+
/ '%/
*
(
'%/
1
7 *
*
+
8
2
1
*
2 +
"
Figuur 4.8 – DataSet designer
#
,--0
0
1
*
/
*
0
1
*
,--0/
*
ADO.NET 2.0
113
1
*
1
0
"
*
+
(
1
%
*
;
*
(
1/
E +
2
*
*
*
1
1
"
+
F
."P" H
1
*
1
*
*
"
*
<
5
*
*
*
"
Figuur 4.9 – DataGridView ondersteuning
'
1
*
$
*
5
!
7
2
1
$
8"
# 3")
C"4 1
*
#
1
+
8 !-/
8 !-/ !
*
/
*
*
1
* 2 *
(+
1
*
8 !-/ (
7
*
(
2
*
1
*
";
/
*
+ " # 3")
*
(
,"- * (
"
3
55
8
*
4 (+
*
"
* +*
+
E(
F
*
ADO.NET 2.0
114
(
1
2 +
9
(
(
1
"
(+
*
4
9
9
"
<
21
C"4 1
# 3")
(
(
7
# 3")
"
*
8 !-/ /
(
4
,"-
4
(
+
(
"
*
*
<)
*
BC?D2 ( " CG-"
)
# 3")
C"4 1
L %/
*
L %
1
*
(
*
*
" ;
" # 3")
,"-
(
" L %/
*
L %
2
*
L %/
+
(
;
*
"
L %/*
*
*
"; (+
5
*
7
8"
*
*
<
59
,
L
*
)
,
DataSet ds = …;
ds.RemotingFormat = SerializationFormat.Binary;
3
*
(
1
*
(
" ;
*
;
1
2
"
1
*
(
*
1
(
*
1
1
"
*
59
(
(
(
1
"
#
/
5
"
*
*
*
+
,
*
(
1
( *
*
*
1
1
+
/ (+
1
2
+
*
"
4
+
(
+
*
+
(
1
ADO.NET 2.0
115
static void Test(string db, string tbl, int n, out long binSize,
out long xmlSize)
{
string dsn = "server=…;uid=…;pwd=…;database=" + db;
string query = String.Format("SELECT {0} * FROM " + tbl,
(n == 0 ? "" : "TOP " + n));
SqlConnection conn = new SqlConnection(dsn);
SqlDataAdapter adap = new SqlDataAdapter(query, conn);
DataSet ds = new DataSet();
adap.Fill(ds);
IFormatter f = new BinaryFormatter();
using (FileStream fs = new FileStream(bin, FileMode.CreateNew))
{
ds.RemotingFormat = SerializationFormat.Binary;
f.Serialize(fs, ds);
}
using (FileStream fs = new FileStream(xml, FileMode.CreateNew))
{
ds.RemotingFormat = SerializationFormat.Xml;
f.Serialize(fs, ds);
}
binSize = new FileInfo(bin).Length;
xmlSize = new FileInfo(xml).Length;
File.Delete(bin);
File.Delete(xml);
}
*
1
7
*
*
*
(
+ 8"
*
*
N 5
*
long b, x;
for (int i = min; i <= max; i += step)
{
Test(db, tbl, i, out b, out x);
Console.WriteLine("{0}\t{1}\t{2}", i, b, x);
}
(
*
(
7(8
*
*
* *
N 5
1
*
*
*
C-."C-"
0---
+
+ 7 82
L %/
*
748"
$
*
*
/ (
C--" ;
*
/
*
*
(
1
ADO.NET 2.0
116
DataSet serializatie (Gandagas - Client)
10000000
9000000
8000000
Omvang (bytes)
7000000
6000000
Binary
5000000
XML
4000000
3000000
2000000
1000000
4900
4600
4300
4000
3700
3400
3100
2800
2500
2200
1900
1600
1300
1000
700
400
100
0
Aantal rijen
Figuur 4.10 – Bestandsgrootten voor DataSet serializatie van de tabel Client
;
( +
(
(+
*
"
."CC
*
*
*
*
1
1
"
DataSet serializatie (Gandagas - Client)
Compressiegraad binair/XML (%)
70
60
50
40
30
20
10
4900
4600
4300
4000
3700
3400
3100
2800
2500
2200
1900
1600
1300
1000
700
400
100
0
Aantal rijen
Figuur 4.11 – Compressiegraad van binaire DataSet serializatie van de tabel Client
(
(
*
5
.- [" ;
*
1 +
2
*
(
*
ADO.NET 2.0
117
@"
(
."C, 1
*
7
#
4#*
1
(
(
+*
*
8"
DataSet serializatie (Gandagas - Client)
6
Tijd voor serializatie (s)
5
4
Binary
3
XML
2
1
4900
4600
4300
4000
3700
3400
3100
2800
2500
2200
1900
1600
1300
1000
700
400
100
0
Aantal rijen
Figuur 4.12 – Uitvoeringstijd voor DataSet serializatie van de tabel Client
L %/
+
*
+
* 1
L %/
1
(
(
+
1
"
0
(
( *
8*
( 7
(
(
1
)
*
1
/*
(
1
N
*
*
(
(
21
."CG
*
*
(
*
"H
+*
5
(
(
*
$
(
+
(+
1
3
+
*
* 1
0--- + ( + (
*
*
(
(
"
#
(
*
*
*
C0 [ *
/
"
" ;
(
ADO.NET 2.0
118
DataSet serializatie (Northwind - Order Details)
Compressiegraad binair/XML (%)
70
60
50
40
30
20
10
2000
1900
1800
1700
1600
1500
1400
1300
1200
1100
1000
900
800
700
600
500
400
300
200
100
0
Aantal rijen
Figuur 4.13 – Compressiegraad van binaire DataSet serializatie van de tabel Order Details
(Northwind)
(
*
* (
1
*
"
(
*
1
( + (
*
+
L %/
"
DataSet serializatie (Northwind - Order Details)
0.05
0.045
Tijd voor serializatie (s)
0.04
0.035
0.03
Binary
0.025
XML
0.02
0.015
0.01
0.005
1900
1700
1500
1300
1100
900
700
500
300
100
0
Aantal rijen
Figuur 4.14 – Uitvoeringstijd voor DataSet serializatie van de tabel Order Details (Northwind)
ADO.NET 2.0
119
*
*
*
+ *
*
(+
8"
*
1
+
+
*
*
."C,
+1
*
)
1
(
* 1
."C0
."C?"
*
3
5
8
*
*
*
1+
7
1
(+*
*
"
*
*
1+
*
+
(
*
/*
*
5
/*
1
7*
2
/ (
( +(
*
;
+ 7 "
$
(
1
(
1
+
*
2
2
*
4
8
1
1
*
/*
1
*
"
(+
*
/ (
*
+
*
*
"
( "
1
7
(+
*
*
*
*
(
*
"
(
+
(
(
( + (+
8"
DataSet serializatie (Northwind - Orders)
Compressiegraad binair/XML (%)
70
60
50
40
30
20
10
850
800
750
700
650
600
550
500
450
400
350
300
250
200
150
100
0
Aantal rijen
Figuur 4.15 – Compressiegraad bij binaire DataSet serializatie van de tabel Orders (Northwind)
"
ADO.NET 2.0
120
DataSet serializatie (Northwind - Orders)
0.08
Tijd voor serializatie (s)
0.07
0.06
0.05
Binary
0.04
XML
0.03
0.02
0.01
1600
1500
1400
1300
1200
1100
1000
900
800
700
600
500
400
300
200
100
0
Aantal rijen
Figuur 4.16 – Uitvoeringstijd voor DataSet serializatie van de tabel Orders (Northwind)
:
1
(
*
(
(
" ;
9
*
2! (
*
$
7(
I
(
*
*
*
9
+
+
(
(
*
1 (
*
*
(
*
1
*
*
1
1 (
*
H *4
/
*
(
*
2
*
7 4
*
(
";
1
+
+"
"
( *
;
*
(
+
8 !-/ 8
1
(
*
*
*
(
1
*
" "#" ;
*
8"
1
*
(
/8
$
*
*
")
*
+
* 1
,"- ( *
2
1
*
1
1
(
1
/
*
1
(
1+ *
*
(
'
"
&
/
1
2
1
1
ADO.NET 2.0
121
*
*
E
F"
(
+
*
+ (
1
*
1+ ";
(
(
*
1
2
*
(
(
*
*
1
*
*
DataSet ds = …;
MemoryStream ms = new MemoryStream();
GzipStream s = new GzipStream(ms, CompressionMode.Compress);
ds.WriteXml(s);
byte[] compressed = ms.ToArray();
3
*
(
1
*
1
(
1 I
"
( +1
(
*
( *
(
*
* ";
*
1
(
*
1
7
*
*
"
(
1
5
/
( * 8"
* 1
I
L /
*
7
*
")
*
8*
1 *
*
*
L %
*
(
(+
*
(
Tabel 4.2 – Vergelijking binaire serializatie versus gzip compressie
Database
Tabel
Binaire serializatie
Gzip compressie
Compressie (%)
Tijd (s)
Compressie (%)
Tijd (s)
Gandagas
Client
40.72
5.36
7.54
1.92
Gandagas
Invoice
48.64
6.52
7.21
1.54
Northwind
Orders
30.53
0.02
14.14
0.07
Northwind
Order details
15.17
0.01
7.20
0.04
*
*
FileStream fs = …;
GzipStream s = new GzipStream(fs, CompressionMode.Decompress);
ds.ReadXml(s);
1
(
( +(
(
.", 1
*
+
*
2
*
2
*
1 /
*
"
+
1
21
*
*
"
ADO.NET 2.0
122
(
*
*
";
/
")
*
*
*
1
2
,"(
+ (
1
5*
(5
)
*
*
"
+
(
*
1 (
*
(
*
*
*
3
")
?"-
*
&
/
/#
A
(+
/
(
(+
1
7
3#!/(
#
*
"
*
4 $8"
*
* (
1
(
+
*
*
A
8 !-8
(
1
+
*
"
2
*
*
*
"
0
8 !-/ !
&
# 3")
(
C"4 (
*
#
/
*
/
"
(
(
7
8*
/
*
/
*
" ;
(
1
7*
*
1
1 8" H (
1+
*
*
*
(
&
*
*
1
+
1
*
2
1
" ; ( +1
+
(
"
DataSet ds1 = …;
DataSet ds2 = …;
ds1.Merge(ds2, true);
*
*
*
*
1
1+
*
*
* ")
+
*
,2
*
1+
7
8
1+
+
7
+
C 1
8 +
C *
C
ADO.NET 2.0
123
9
+
*
1
";
*
40
*
(
(
1
1
(
/
1+
1
"
*
/
C"4
1
(
+1
*
(
/
(
0
1
(
,"-
C"4" H (
1
1
# 3")
*
# 3")
# 3")
"3
N *
(
4(
*
1
$
1
*
( -*
*
0
+
+
+
8 !-/ (
(
4
*
/
4
(
5, $
*
"
*
KK *
1
$
Tabel 4.2 – Vergelijking LoadOption in beta 1 en beta 2
Beta 1
LoadOption.OverwriteRow;
LoadOption.PreserveCurrentValues;
LoadOption.UpdateCurrentValues;
3
(
*
"
2
(
((
1+
1
( * "
5
2
2
2
*
2:
"
1
*
7
(+ 1
"
1
")
1+
( *
*
+
+
*
*
*
6444 8"
1
1
*
+ 1
(+
*
1
K
(
* (
;
"
*
+(
1+
+ 7
2
+
( *
1+
9
#
(
Beta 2
LoadOption.OverwriteChanges;
LoadOption.PreserveChanges;
LoadOption.Upsert;2
(+
2
1
0"08"
Het gedrag van LoadOption.Upsert in beta 2 verschilt van dat van LoadOption.UpdateCurrentValues in beta 1
met betrekking tot verwijderde rijen. Rijen die offline verwijderd werden, worden niet hersteld in hun originele
vorm indien de inkomende DataSet deze rijen opnieuw bevat. In plaats hiervan wordt de inkomende rij
toegevoegd aan de DataSet met als RowState de waarde Added.
ADO.NET 2.0
124
*
*
&
1
(
*
*
1
&
M
1+
(
1
+
M
1+
+
1
M
1+
1
54
1
*
1
(
1+
+
/
(+
$
*
*
/
:
/
"
1
1
/
+
"
(+ 1
(
1
1
1
"3
*
"
*
*
( 1
*
1+
8 !-/ /
:
% $
1
#
1
*
/
"
1
(
&1
*
%/
4 *
2
#
1
1 1
&
(
2
%/
= *
4
0
1
*
(
(+
1
+
";
*
&
8*
'%/
2
* "
"
7
(
1
1
1
"
"
1
1+
&1
1
1
2
;
:
(
1
*
1
1
(
+
1
21 (
"
'
(
*
1
&
*
1+
(
"
3
+
(
*
*
%
'1
*
(+
*
*
2 1
1
(
/1
1
+
"
*
(
* (
*
& 1$
/ *
(
*
ADO.NET 2.0
125
void tbl_RowChanging(object sender, DataRowChangeEventArgs e)
{
if (e.Row.RowState == DataRowState.Modified
&& e.Action == DataRowAction.Change)
e.Row.RejectChanges();
}
*
*
1
7
8 !-/ 8
;
8 1
*
1
*
(
"
4
(
*
*
*
*
(+
*
(
/
(
7
G"J8" #
5
/
/
*
(+
1
1+
1
&
8 !!
(+
*
+
*
1
" ;
(
*
"
0
*
(
*
+
# 3")
,--0 *
*
1
*
"
*
,"- *
+
*
1
1
*
1
(
*
(+
* *
(
(
,--0
1
1
."CJ"
Figuur 4.17 – Data controls
1
*
1
2
1
0
55
/
2
+"
55
*
1
"
ADO.NET 2.0
126
*
0
%
(
/
/
(
(
*
1
"
(
(
*
(
1
1
1/
1
*
1
+
*
(
C"48 1
:/
*
."CJ
(
"
1
,
*
0
1
1
&
."CQ *
1
(
1
1
"
8
(
*
*
*
1
*
$
4
$
*
"
1
* (
4 *
N *
(+
(
*
2
*
1
*
7
1
*
(
(
8"
"
";
*
$
7(
/
(
"
*
7 " BCJD8"
7
1
"
*
*
*
#
*
(
+
1
1
*
1
"
")
."P
"
*
1
*
"
*
*
*
*
*
*
(
1
4
* *
*
(+
/
"
1
1
1
(
7
55
1 *
"
Figuur 4.18 – DataConnector indirectie
1
1
(
+
(
$& 7
*
0
*
/
0A?" H
+2
*
8
(
+
1
"
")
1
(
,"- (
*
*
/
ADO.NET 2.0
*
127
KK E
F1
1
/
* "
."CP ( *
1
1
"
,--0
*
*
*
(
*
7
*
3
*
1
(+
L!
7( +
*
8
3
(
,--G8 1
E
1
(
F*
1
(
(
(
"
1
*
*
1
"
Figuur 4.19 – Sfeerbeeld van het werken met data controls in Visual Studio 2005
."CP
,--0/
ADO.NET 2.0
128
8 !(
&
8 !( !
4
)
# 3")
# 3")
,"-
1
"
*
# 3")
3
1
# 3")
+
,"-
1 (+
*
(
:
/
1
1
( -7*
*
1
(
(
1
*
(
*
(
BC?D2 "
1
,--0/
*
+
* "
*
*
*
2
*
'
*
*
2
*
,"-
1
(
*
*
+
2
*
(
1
(
1
* (
*
*
((
* (
*
(
,"-
(+
8"
*
1
1
2
(
"
8 !( (
;
1
<
1
3
1
*
*
(
/
1
1
*
* *
+
(
1+
*
"
+
( *
*
,""
1
&
/
"
*
1 +"
(
*
2
( *
*
1+
0
/
(
(
# 3")
*
*
(
*
/
*
1+
*
"
*
(
*
(
";
*
(
1+
(
*
/
=
*
,"-
*
#
1
*
# 3")
'
(
*
(
1 (
5
*
1
*
5
ADO.NET 2.0
129
1
* 1
";
*
(
(
/
/
";
(
*
*
(
7( +
*
5
(
(
'%
(
*
(
( 2
(
2
/ *
* "
*
*
(
0
*
/
*
4
/
*
*
*
*
(
*
1
"
+
(+
E
F
*
*
* "
+ +
* 8N
*
*
1
4
";
*
*
'%
*
/ '%
*
*
"
(
#&
+
* 21 (
7
'%
*
+
*
*
(
2
(
(
")
*
9
8 (+
*
(
(
*
*
(
"
,--08 *
2
*
*
*
*
( *
" #
KK
*
1
(
*
#& ( +
(
*
*
1
+
*
*
(
7
(
&
1
"
#
(
,--08
(+
*
(
,"-
' #!
(+
*
*
# 3")
*
2
5
*
*
*
4 ( *
( *
(
";
1
(
*
*
(
(
*
/
;
1
"49 7
( <*
7
1
2
"; (
*
/
"
*
*
*
*
1
,---8
*
(
*
/
(
&
1+
2
(
(
*
"
+
(
*
(
*
*
1
(+
(
"
ADO.NET 2.0
130
*
*
(
(
2
*
*
"
*
(
*
"
(
(
*
(
+ 2
*
1
(
( <*
* "
*
+
2
*
1
*
1
+ 1
(5 2
( <*
(
*
*
#
+ +
*
1
;
(
*
'
0
/
8 !( /
' #!
(
+
%(
%(
%(
"
0
*
*
# 3")
&
*
*
"
(+
*
1
(
* "H
*
3
(+ *
5
5"
7
"
* 1
+8 *
5(
(
1
,"-"
7
*
*
# 3")
,"-
(
+
#5
(
$
#
*
*
*
/ *
/
* (
* (
1 *
,--0
*
/
/
(
7 '% ,--08
#& 7 '% ,--08
:
= 7 '% ,--08
*
1+
*
(
1
*
"
*
9 "
(
*
*
*
*
ADO.NET 2.0
131
*
(
2
*
(
*
%) *
2
1 1
*
(
* (
"
+
*
"
*
( *
*
(
/
(
*
1
*
5
(
*
* +
2
(+
"
*
*
/
1
*
(
*
*
1
*
*
*
* "
*
*
))
*
4
5
46
!
*
(++
+
(
"
3#! *
1 (
(
1
*
+
(+
(
(
*
*
*
*
*
5
(
1 (
*
( +1 (
3#!/
*
*
*
#
*
1
2
*
*
9
";
(
(
*
1 (
*
21
";
(
1 (
*
!!
91&O 7&
!
$
(
*
1 (
*
*
&!$= 1
1
*
"
;
1
9 "
KK *
7 48
*
L %
*
1 (
1
*
2
*
4
((
F
1
3#
*
" K
*
*
")
E
8
";
(
"
7
(
1
*
*
*
Services are distributed components, which provide well-defined interfaces that process and deliver XML
messages. 7
BCCD8
*
(+
1
"
((
5
(
*
"
*
3#/
1
1
(
*
"
132
1 (
*
(+
+
*
(
2
1
1
(
*
1
\
Service-Oriented Architecture (SOA)
+
(
133
5
1 F
* (
*
5
*
(
*
1
")
*
"$
1
*
(
(+
*
1
(
7
3# ( 1
*
(
7
8
(
*
7
*
(
M
/
8 +
(
"
*
+
*
3# 1
1+
*
1
*
(
*
+*
"%
1
*
*
5
2 *
*
(
+ (
(
= "3
1
(
1(
+ *
*
*
+
"
1
1 (
%
*
*
"
(
"
((
"
* : 0/
(
1 (
(+
1
L %/(
4
"
8
1 (
*
1
(
7N
1 (
(
1
3
(
"
*
2
* 1
'
KK *
*
7
7
"
+
*
!/
+
"
'
1
*
(+
*
1
# (
(
1
4
*
(
*
* (
*
;
*
*
*
!(
E(
*
*
(
1
*
(
21
%
*
H 0$/
L %/
Service-Oriented Architecture (SOA)
134
(
*
(
*
*
*
(
( 1
"
(
(
(
*
*
(
1 (
+
*
*
*
*
(
1
4( "
5
(
M
M
*
+
(
%
1(
+
4(
'
*
%
(
*
*
*
*
(
M
*
M
+"
4
*
(
1
' 7
1
*
\
7 $
*
(
7
"
1
(
1
8
8
/
*
*
*
*
"
1 (
(
*
45
*
1 (
1 (
*
"
(
*
2
*
%/
*
*
/
1
8"
!8
1
*
(
1
1
(
+
1
(+
(
1
*
3#/
P
*
(
/
*
*
(
/ (+
*
+
*
*
4
*
2
*
*
"
*
1
3#/(
*
*
*
*
*
"
1
5
(
"
*
/
Service-Oriented Architecture (SOA)
135
*
(
(
5
*
1 2
*
( *
3
*
(
+
(
1(
*
"
*
(
*
(
(
(
*
"H * 7
5
/
1
(
*
+
52
/!
52
/
2
*
"8
7
(
(
(+
1
1
(
1
/
*
*
*
"
1
"
&
(
*
( *
*
*
/
5
*
(
1
1(
(
*
(
*
*
/&
21
(
2
"
0
+
(
*
7:
7
*
7
/!
58
(
8"
*
(
21
/#
L %AL
1
(
7
*
8
;
!2 ;
"
/
+
"
*
21
(
3#!/
*
*
1
! 2
*
!2
*
1 (
*
"
*
/]
1
*
1
*
H *
H *1
H *4
3
8
*
((
* *
7L
+
*
"
*
%82 (
'1
'
(
*
5
*
*
*
*
/
*
*
(
"
"
* *
(
"
Standaardisatie van een reeks voorstellen van onder andere Microsoft, eerder geformuleerd onder de noemer
GXA (Global XML Web Services Architecture).
Service-Oriented Architecture (SOA)
H *
136
&
(
/
9
(
(
1(
1(
"
H *9
"
(
+
(
3#
(
(
(
2
(
+" 3
*
*
*
444 *
*
(
+
*
1
*
"
H
(!
(
*
7
*
3
H
*
*
# !")
1
8
")
/
2
+
*
1
( 5
*
(
*
/
,"- !,"
1 (
(
*
1
I( 1
*
"
( *
" $
I
!
*
*
/
*
"
"C"
Figuur I.1 – Filteringmechanisme van WSE (Bron: [12])
( 1
(
3#!
*
*
*
(
*
* 1
(
*
(
* 1
1 (
2 (+
*
(
*
1 5
(
*
(
*
H
":
+
*
5
(
2
*
*
" ;
/
( +
*
"
1
", 1
* "
Service-Oriented Architecture (SOA)
137
a. Request
b. Response
Figuur I.2 – WSE pipeline (Bron: [12])
Service-Oriented Architecture (SOA)
((
138
&
3
1 ("
(
*
/(
4
/
*
# !")
1 (
*
/
"
<configuration>
<system.web>
<webServices>
<soapExtensionTypes>
<add type="Microsoft.Web.Services2.WebServicesExtension,
Microsoft.Web.Services2,Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
priority="1" group="0"/>
</soapExtensionTypes>
</webServices>
</system.web>
</configuration>
(/
,
;
(
*
(
*
(
(/!
*
(
(
*
* 1+
+
*
(
*
,"-
* "
*
/]
(
1
"
BC,D"
7
UU
*
1
(
*
1
+
<
*
( *
1 (
% 7;
*
*
/
! 8
*
*
2
*
4
1
1
3#!
*
*
1
5
"
"#
"
/
1
51
(
( *
+
(+
";
*
( + () #
(+ (
1
3#!
*
( *
*
1
(
*
+
1 (
5
*
(
1 (
" K *
*
+
*
*
(
(
/
2
/
*
( +" #
$
*
/
5
Service-Oriented Architecture (SOA)
!
"
1 (
*
139
*
(
21
(+
(
*
2
*
*
(
"
(
!6 7! (
*
"
*
6 5
*
(
(+
7
(
*
"G" 8" #
6 (
:
2
*
(
2
(
A1
"G"(
1
1
5
"
2
1
/
7*
(
L"0-P2
"
*
*
(
(
5
( +;
/&
2
/
*
*
*
*
L"0-P
A1
1
1
(
"
'
5
*
(
*
6 (
L"0-P/
8" ; ( +1
*
(
5
1
! 2
2
/
(
*
*
8
/
( *
"
( *
* 1
*
+
*
2
"3
*
7
8
*
N
1 (
*
*
proxy.RequestSoapContext.Security.Tokens.Add(userToken);
proxy.RequestSoapContext.Security.Timestamp.TtlInSeconds = 60;
(
*
5
1
*
$
1 (
*
/
*
1
*
7( +
*
(
4
71
")
*
82
*
*
*
8
7
8
4"
+
*
" 3*
5
*
N
1
*
*
(
*
45
"
("
*
,"
(
1+
*
$
!
1
/(
Men kan zelf een dergelijke security token implementeren door middel van de basisklasse
Microsoft.Web.Services2.Security.Tokens.SecurityToken.
2
*
Service-Oriented Architecture (SOA)
(
*
140
1 (
*
/
4
"3
*
2
1
")
2 1
(
*
<
*
2
*
/
"
a. Digitale handtekening
b. Encryptie
Figuur I.3 – Voorbeeld van beveiliging in WSE (Bron: [12])
(/(
1
K *
(
(
'
+
/]
*
1+
1 (
(
7( +
*
*
(
", 1
*
(
(
*
L"0-P/
8 1
9
*
2
'
*
"
"
+
*
'
^
_7
5 *
"
'
1
^
'1
(
"
5
H *1
_ 71
1 (
*
*
*
* * 8
/
8"
/
^
5_"
Service-Oriented Architecture (SOA)
141
2
*
*
+
*
*
(
"
!
("
+
21
"
("
*
*
,"!
,"!
5" !
5"!
*
5#
5
9
*
*
*
1
*
3#!/(
*
8
8" ;
*
/
(
*
5( +
*
*
(//
(
+
*
7
(
*
"
+
1 (
*
7
(
(+
*
(
7
(
*
5/
8"
9
H *9
(
*
*
*
+
(
3#!/
5
)
(
(
(
1
(
*
!/
L %
.(
*
*
"
Figuur I.4 – WSE router structuur (Bron: [12])
*
*
* 1
(
1
"
"
( * "
"
".
Service-Oriented Architecture (SOA)
&
1 (
*
142
*
*
(
*
*
1+
*
$
(
1
1
*
*
^
_/
1 ("
*
1
" ;
+
/
"
L %/
"
*
1
(
*
/
*
<?xml version="1.0" ?>
<r:referrals
xmlns:r="http://schemas.xmlsoap.org/ws/2001/10/referral">
<r:ref>
<r:for>
<r:exact />|<r:prefix />
</r:for>
<r:if >
<r:ttl />
<r:invalidates>
<r:rid />
</r:invalidates>
</r:if>
<r:go>
<r:via/>
</r:go>
<r:refId />
</r:ref>
</r:referrals>
Q
R
(
4
4
%/1
*
1 1
KK Q
:&
N
*
"
R/
Q
1
1
R/
*
*
+ "
1
1
*
*
3
Q
^ * _/
(
"
("
1
(
+
*
+
*
,"
;
/:& 1
&
*
*
(
"
(+
*
(
"
1
"
"
3#!/(
R/
*
!
Uri ProcessRequestMessage(SoapEnvelope message);
*
*
&N
(+
*
*
(
/
"
Service-Oriented Architecture (SOA)
2
1
(
143
*
*
3#!/(
(
1+
2 1
7( +
*
*
.(
(+
( +
* " 3
(/8
/:&
"H
(
(
2
(
(
*
L %/
(
8"
4
6
1 (
*
(
9
(+
(
*
(
(+
3#!/(
"
1 (
*
H *4
*
(
"
1
(
3#!/(
7
(
*
5
L %/ (
*
*
*
8"
*
*
*
(
*
1 (
*
+
2
*
";
*
*
(
* *
ResponseSoapContext.Current.Attachments.Add(
new DimeAttachment(mime, format, file)
);
1
(+
5 7( +
*
5
7( +
*
(
*
(
5
5
1
(
*
0 8
"
5 8"
7 "
*
(
(
1
2
1
1
(
7( +
*
8
(
'%
* 8
"
*
*
1
(
1 (
1
*
*
(+
*
(
+
*
proxy.ResponseSoapContext.Attachments[0].Stream
*
(
Service-Oriented Architecture (SOA)
(/.
144
41 "
# !")
1 (
+
*
1
1 (
*
*
(
1
1
(
"
( *
2
1
N
";
(
*
(
*
&1" ;
A
/
+
*
/
*
1
"
+
3#!"
(
1 1
*
'
1
(
1
(
(
*
KK
9 ;
$
1 (
*
(
F *
;
*
*
1 1
(/=
+
*
/1 5
1 (
4
8"
$!/ (
(
!2
1 (
5
*
"
7
3
+
* "
1
E
2
*
&
<
1 *
"
(
2
(+
*
1 (
(
*
1
5 *
/
1
*
"
&
"C
",
((
+
1
1
* *
52
;
,"- *
*
*
" )
8
9
/
71
52
*
"
(
1
/
*
*
"
* (
*
&
1 (
3/
"
K *
(
+
*
1
1
*
Service-Oriented Architecture (SOA)
5
145
*
/
*
*
,
(
N
3#!/(
"
(
*
"
(
1 ("
!
*
1
/
8"
*
"
2
/
*
7*
<
*
*
( *
N
,
1
1
(
<microsoft.web.services2>
<filters>
<output>
<add type="CustomFilterLibrary.CustomInputFilter,
CustomFilterLibrary"/>
</output>
<output>
<add type="CustomFilterLibrary.CustomOutputFilter,
CustomFilterLibrary"/>
</output>
</filters>
</microsoft.web.services2>
/
@
/!
3
*
&
*
*
*
+
/
*
444*
7 "$
1
4
82
1
'*
*
'
* (
*
*
(
5
*
(
5
(
7 "
/!
* (
*
75
*
+
*
*
+
*
*
*
7
8
*
4
8"
( *
*
$ 8"
(
58
*
(
1 1
* "
1
3
(
*
*
1
E! #$ F
*
(
1
*
"
7
+
*
(
Service-Oriented Architecture (SOA)
4
'
146
*
"
*
+
*
*
(
(
7
8
*
"
&
*
7 "
%8 1
(
*
1
*
(
*
(
(
1
"
*
=
*
M
* (
1
4
*
(
+ "
*
K *
/ (
*
3#/
1
1
(+
5
*
*
1 (
"
1(
B
1 (
*
1
H 0$/
(
D/
"
(
*
"
(
"
+
*
1 (
*
48 1 (
*
/
3
"
/
1 (
*
(
*
(
*
*
" ;
*
"
*
*
*
1 (
*
*
1 (
*
7
*
+ 7"
21
9
8
/(
*
45
"
*
*
(
*
1
*
*
9
("
5
*
*
# !")
21
/
( 5( *
(
(+
9
1
5
*
(
91&/
(
="
1 2
"
(
: 0/
#
(
*
*
1
"
*
+
(
;
1
@
3#
"
KK
"
/(
5
*
1
*
*
( 1
"
3
*
*
(
")
45
(
*
.
Service-Oriented Architecture (SOA)
1
147
1+
55
N
7 "L
/
/
= 8"
+ (
(
*
1 (
*
";
(+
* 1
1
*
1
1
1
*
1 (
*
1
*
/(
( *
1 (
*
(
1
"
2(
3# *
*
(+
*
*
1
'"
&!$/ (
(
$
+
/
*
(5
*
*
/
+
1
1 (
*
1 (
*
'
/
1
* (
[WebMethod]
public OutputType GiveMeService(InputType in)
{
return new MyBusinessComponent().GiveMeService(in);
}
:
* (
1
*
*
*
*
";
(
*
(
*
( *
* 1
/
*
KK
*
"H
*
*
*
"
*
/
(
( +2
(
1 (
*
1
"
*
KK
(
2
5
*
*
*
1 (
1
"
*
P
(
1
(
7 8"
*
*
*
1
1 *
+
1 (
1
+
* *
(
1 (
*
*
(
";
*
$
/
(
(
1
'
Service-Oriented Architecture (SOA)
148
(
9
*
+
*
4
1 (
*
*
\
+
*
(
" ;
1
*
*
public MyService : System.Web.WebServices.WebService, IMyService
{
…
}
*
1 (
*
+
( +*
5 *
*
(
B
*
(
(
+
*
*
"3
(
5
*
D/
*
*
*
45
*
I
*
(
//
"
2
4
*
1
1+
"
(
1
*
1
1
(
(+1
3#/
(
*
1
/
1
*
1 (
*
*
*
*
"
/
2
//!
*
"
*
7
8"
*
H
*
*
(
/
*
!/
*
*
(
;
*
I *
(+
*
2
*
*
(
"
*
"
A
1
*
"
4
/
*
+2
(
1 (
*
*
1
*
+
(
"
# !")
*
2
/
(
1
7
1
+
E
F8
4 ":"
*
;
!/
* "
Service-Oriented Architecture (SOA)
*
H
( -1
"
+ 1
1
1 (
(
4
7
149
(
1
*
*
1
(
*
3#/
(
1
*
(
H
"
*
/
1
1
(
A
( +*
*
( *
*
4(
","G"08" ;
1+
*
7
(
8
"
//(
*
"
*
*
/
(
1
*
1
2 1
* (
$%&2
"
*
*
*
+
*
*
33!/
7
*
(
*
*
* (
2
1
///
(
* *
2
*
2
"8" ;
*
*
"
+
5
*
* *
+
* (
;
*
1
(
1 1
*
2
*
*
7 8"
((
((
(
*
(
1
/
1
(
(
*
/
((
"
*
3
(
*
*
"
"$
"
KK
/
(
*
(
*
(+
*
*
*
"
* (
5
*
3
1 (
(
2
+
*
5
+
( 1+ "
4
*
*
Service-Oriented Architecture (SOA)
//8
150
"
1
1
1
(
"H
9 ;
<
*
'
*
+*
(
(
1
1
+
*
2
(
*
1
1
1
*
*
"
/
&
/1 5
(
*
32
1
/
(
1
2
(
*
(
*
7&!$8
8"
5
1
+7 5
1
*
1
4/
'8"
N
(
*
1
/1 5
1
(
*
"
";
8
2
*
+ (
*
*
7 "
3#!
*
*
*
*
1
2
(
1
* 1
1
5
1
/#
"
*
*
1
"
(
;
* 1
H *4
+
* 1
5
2
1
*
"
"
A
7* ")
1
*
7%!$8
*
*
1
N
5
+
*
*
(
1
1+
(
&
1
5 /
*
*
1
*
"
$!/
3#!/
class ResponseReceiver : SoapReceiver
{
protected override void Receive(SoapEnvelope message)
{
//message bevat het antwoordbericht (gebruik van XSD-schema’s)
MyResponse response
= (MyResponse) message.GetBodyObject(typeof(MyResponse));
}
}
class Client
{
private string from = "soap.tcp://client/ResponseReceiver";
Service-Oriented Architecture (SOA)
151
private string to = "soap.tcp://server/RequestReceiver";
private string requestSchema
= "http://mycompany.org/schemas/MyService/MyRequest";
private void DoRequest(SoapEnvelope message)
{
//registratie van "listener"
SoapReceivers.Add(new Uri(from), typeof(ResponseReceiver));
//verzending bericht
SoapSender sender = new SoapSender(new Uri(to));
Sender.Send(message);
}
public void Receive(string par)
{
//SOAP Envelope voor request bouwen
SoapEnvelope message = new SoapEnvelope();
//instellen van messaging-parameters
message.Context.Addressing.Action = new Action("…");
message.Context.Addressing.From = new From(from);
message.Context.Addressing.ReplyTo = new ReplyTo(from);
//request-bericht genereren (via XSD-schema)
MyRequest r = new MyRequest();
message.SetBodyObject(r);
//aanvraag uitvoeren
DoRequest(message);
}
}
3
*
* *
* 1
" ; ( +1
*
5
/#
*
*
1
&
(
5 /
(
(
"
/:&%= *
*
(
*
1
(
"
class RequestReceiver : SoapReceiver
{
private MyBusinessLogic bll;
protected override void Receive(SoapEnvelope message)
{
if (message.Context.Addressing.Action.Value == "…")
{
//message bevat het inkomend bericht (via XSD schema)
MyRequest request
= (MyRequest) message.GetBodyObject(typeof(MyRequest));
//verwerk aanvraag via business logic layer
MyResponse answer = bll.GetAnswer(request);
//construeer antwoord als SOAP Envelope
SoapEnvelope response = new SoapEnvelope();
response.SetBodyObject(answer);
Service-Oriented Architecture (SOA)
152
//instellen van messaging-parameters
Uri replyTo = message.Context.Addressing.ReplyTo;
Uri myUri = message.Context.Addressing.To;
response.Context.Addressing.Action = new Action("…");
response.Context.Addressing.From = new From(myUri);
//verzend antwoord
SoapSender sender = new SoapSender(replyTo);
sender.Send(response);
}
}
}
class Server
{
public void DoRequest(SoapEnvelope message)
{
//registratie van "listener"
SoapReceivers.Add(new Uri(from), typeof(RequestReceiver));
//verzending bericht
SoapSender sender = new SoapSender(new Uri(to));
Sender.Send(message);
}
}
//.
9
K *
(
+
(
(
*
1
1
/ (
(+
(
*
*
(
1(
*
(
(
(
(+
*
(
(
*
(
(+
*
(
(
*
*
5
8
"
1
<
(
+
(
7( +
*
(
"
(
H *9
"
21
"
*
*
(
" "#"
*
+
*
5
/1 5
'/ (
1
+
*
1
"
1
(+
*
* "
+(+
1
1
"0 1
*
'
/
(
5
(+
1
*
3#/
(
(
"
1
5
7* L
8
Service-Oriented Architecture (SOA)
153
$ 9
@7
(
7
L %8
*
1
* 1
+
*
3
(
7
)
)
*
1
*
*
*
*
(
8
'"
* "
21
7
8
(
1
1
5
*
1
1
*
"
+
"
(+
8
(
1
(
(
4
+
*
1
1
(
"
Figuur I.5 – Werking van MSMQ (Bron: [14])
*
(
1
1 (
(
+
7*
(
(
(
3
1
(
2
(
1 (
*
(
1(
(
*
"
8
(
(
(
1
"
(
SS
1
* "
*
1
(
(
1
+
* 1
1
* (
1
(
+
/
*
8
"
*
7
$
*
+
3#/
1 (
(
*
'
(
+ 1
7
"
3
L %8
5
1
* 1
8
7
*
1
;
*
+ +
1(
* 1
"
*
(
+7
5
"
81
(
(
1
* 1
*
*
Service-Oriented Architecture (SOA)
7
154
8
1
1
(
*
1(
//=
H *9
/&
1
1
1
N
(
A
(
*
*
7
(
*
C-8"
*
(
N
(
(
"
(
*
*
":1 7 3#!
& !*
1
*
*
*
(
*
5
"3
(
4
(
!
1
*
;
1
*
"
8"
+
5
1
+
2(+
*
/
+
9"1 7 3#! &
(
A
1
1
1 2
"
/1 5/
(
'
1
"
(
(
1
(
(
*
'/
1
*
8
*
/(
1(
/&
(+
" "#
"
!
+
*
(+
*
*
*
!/
+(
"
+
")
1
DIRECT=HTTP://server/vdir/TargetQueue
+ (
1
*
3#!/(
+
"
*
3#!
*
1
"&
(
*
*
/8
1
*
;
N_/
2
+ 1
2
"* *
' ( 1
& !/ N *
!2 3#!
'
"
+
* 1+
1
"
"
H
*
KK *
*
*
1
*
1
^
/ 2
*
(
444*
*
*
(
*
(
444*
3#!
*
*
1
(
1 (
*
/
"
(
(
( +
1 (
( +
*
+
1
*
45
Service-Oriented Architecture (SOA)
(
"
*
( *
1
1
(
1
1
*
2
(+
45
*
155
(
3#
1 (
*
*
1
8
*
/
"
*
"
*
"
4
8!
%
;
' L
+
(
*
1 (
1
*
( +
*
"
*
1 (
*
+
444 4
( + 3#/
8
1
*
/]
1
*
(
7
* 1
BC0D *
3#!/
(
1
1
" 3
E( +
( F*
7444* 2
*
(+
8"
4 +
"
3#/
+ +
+
*
/1
+
*
1+
1
*
*
Recall that it took several years for the n-tier architecture model to become fully formed and to gain wide
acceptance as a standard. SOA will also go through an evolution. (Bron: [11], blz. 69)
*
L %2 3#!2
(
*
%2 :
2
1
*
/
*
*
7 "
/"
/
8"
8(
1+
*
*
/
2
(+
(
(
1(
*
<
(
(
'
1
1
(
*
/
*
5
/!
*
7
/&
(
(
8"
* (
(
(
";
*
*
5"
*
(
1(
*
1
(
(
*
(
Service-Oriented Architecture (SOA)
"
(
(+
5
*
(
*
*
*
(
(
1
%
2
/
7
(
1
2
2 ")
&
2
'
*
/
*
(
*
(
21
"
*
9 "
*
(
/
*
*
8
*
*
*
+
*
*
"
*
(
1
/
(
1
(
*
(
*
9 2
*
"
;
5
*
"H
*
#!
(
*
L %
'
+
*
(
156
2 *
*
*
(+
*
[DataContract(Name="TradeInfo", Namespace="urn:schemas-ugent-be:indigo")]
public class TradeInfo
{
private string symbol;
private double tradingat;
[DataMember]
public string Symbol { … }
[DataMember]
public double TradingAt { … }
}
[Service-contract]
public interface ITradeService
{
[OperationContract]
TradeInfo GetStockTradeInfo(string StockSymbol);
}
[DatagramPortType(
Name="TradingService",
Namespace="http://ugent.be/indigo")]
public class TradingService : ITradeService
{
[ServiceSecurity(Name="Broker", Role="Traders"]
[ServiceMethod]
public TradeInfo GetStockTradeInfo(string StockSymbol)
{
…
}
}
/
Service-Oriented Architecture (SOA)
( *
*
7
(
*
1
+
%/
157
1
L
*
/
*
=8
8" #
;
*
(
2
7
(
"
9
2
*
2
*
*
2
1(
(
(
2
"
+
+
* "
*
*
2 1
2 (
*
(
/
5
*
*
+
+
(
*
*
2
"
(
1
(+ + (
1(
"
+
*
1
*
(
+ 1
7( +
*
(
;
+
(+
1
(
"
(
2
(
+
1
*
1
'
+
1
4
* 1+
1
' *
"
1
4
*
*
J"
N *
*
1
8"
* 1
+
2
*
*
"
(
+
*
4
4
"
*
1
*
1
1
2
.
#$:"$
.!
'%L %
*
'%
*
,---
1
/
(
(
*
1
(
(
1
(
*
*
L %
% $ /
*
V4 V
(
3! )L %
*
1
1
*
*
(
(
* ;
!/
2
*
!
(
)
& /
#$:"$ 7
/
"
1
(
*
(
2
3
( *
*
( 1
*
+
+
*
(+
*
( " ;
*
2
$
(
1
3& L %
(
"
*
2
L %/(
"
L %/
1
*
*
$
;
*
+
+
/ '%/
L %"
4
"
"
4
*
:"$
(
*
"
% $ /N 5
1
(
(
*
G"- !G"
( *
*
*
(
L %"
'%L %
(
*
*
2*
+
, 9 :"$
*
1
* ;
*
"
158
";
1 (
*
'%L %
*
!*
1
( 1
3#!/
SQLXML
159
*
"
*
'%L %/
(
'%L % * 1 +
+1 *
*
(
4
1
*
<
2
+
*
"
*
*
,
#
/
"
.(
0"C
1
/
1
*
'%L %/
*
1
*
1
"
(
'%L %/
#! / 4
*
2(
(+
"
1 (
"H
*
;
!2
3#!2
*
5
1
*
(
* 1
"
6
*
(
*
5
1 (
*
Figuur 5.1 – Overzicht van SQLXML (Bron: SQLXML help)
*
#! / 4
* 1
(
'%3%
7
N G" 8 (
*
'%
1
( 1
1
(
(
*
1
*
!/
(
2 1
/
(
*
"
,---/
" 3
+
(
*
;
+
*
*
1
*
*
'%L %
*
*
2
1 *
*
N
SQLXML
160
"#
*
1
% $ /
)
& /2 :! #
= 7L
A
(
/
L &8
%
1
/
2
1+
"
L %/
+"
./
./!
;
*
(
*
"
'%/
*
+
1
(
1+
+ 1
:&%=
*
(
(
4
*
1
1
1
(
(
( *
L!
1
1
'%/ 5 4 *
*
(
/
/N
( *
1
1
(
*
1
+
*
KK
"
1
+ L %/
'%/
N
*
2 L %/
A
2
*
L!
*
1
/N
"
'%/
*
L!
(
"
1
7
"
"
*
*
(
2
1
(
" ;
+ 1
(
(
*
'
21
2( +(
( *
+
"#
1
2
*
1
+*
;
+
(
1
*
"
*
(
#!
'%/
(
*
'%L %
/
8
L
1
/N
*
<ROOT xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<sql:header>
<sql:param name="Firm"/>
<sql:param name="ID"></sql:param>
</sql:header>
<sql:query>
EXEC sp_get_ArticleByID_forxml @Firm, @ID
</sql:query>
</ROOT>
"
*
(
2
*
SQLXML
161
(
1
1 1
;
!/
"
*
2
*
+
1
1
(
/
"
*
/
1+
V V#
"
(
2
*
*
5 V 4
V V#
5
, 9 :"$/( *
CREATE PROCEDURE [sp_get_ArticleByID_forxml]
@vFirmID
int,
@vID
char(10)
AS
IF @vID <> ''
BEGIN
SELECT [ID], [Description], [Remark]
FROM [Article]
WHERE [Firm ID] = @vFirmID AND [ID] LIKE RTRIM(@vID)+'%'
ORDER BY [ID]
FOR XML AUTO
END
ELSE
BEGIN
SELECT [ID], [Description], [Remark]
FROM [Article]
WHERE [Firm ID] = @vFirmID
ORDER BY [ID]
FOR XML AUTO
END
GO
#
(
3& L %/
*
&#
L!% $
" ;
L %/
./(
*
(+
(
*
*
*
*
"
&
(
2
/
*
(
'%L %" ; ( +*
*
"
+
E!
/
1
E
(
((
*
1
1
(
F
*
$
*
*
(+
F
/
*
E `
(`111
`
F"
SQLXML
162
*
(
(
(
'%,---/
3
((
(
"
(
* 2
1
*
(
*
1
/
'%/
"
N
Figuur 5.2 – Inschakelen van template queries
1
1
"
*
*
*
E
((
F
;
E `
-
*
7
0"G8" ;
(`111
`
`
Figuur 5.3 – Configuratie van template virtual name
*
*
#
5 "4 "
" ; ( +1
1 *
F"
SQLXML
)
163
*
*
*
"
*
*
*
1
*
( 1
2
*
;
1
*
!/
0"."
Figuur 5.4 – Bevraging van het template over HTTP
*
:&% +
+*
(+
*
*
2
.//
"
21
*
(
(
(
*
1
* "
%
)
9
(
"
*
+1
'%L %/
+
(
'%
;
")
<
+
(
*
*
*
!/
*
";
5
* /
(
(
*
") "
($
*
*
(
/
string url = "http://…/ArticleById.xml?Firm={0}&ID={1}";
string request = String.Format(url, firm, id);
WebClient clnt = new WebClient();
DataSet ds = new DataSet();
ds.ReadXml(clnt.OpenRead(request));
(
1
*
*
SQLXML
164
* +
*
(+ (
*
*
1
L %/
&
( 1
*
*
*
*
(
*
55
/
*
./8
L %" ;
*
L "
L
(
7
*
(
8"
*
*
(
*
1
1
1+
*
*
(
1
(
1
(
"
#! /
2
";
(
1
(
(
*
(
(+
1
*
*
string dsn = "Provider=SQLOLEDB;Server=…;database=Gandagas;uid=…;pwd=…";
SqlXmlCommand cmd = new SqlXmlCommand(dsn);
cmd.CommandType = SqlXmlCommandType.TemplateFile;
cmd.CommandText = "ArticleById.xml";
SqlXmlParameter pID = cmd.CreateParameter();
pID.Name = "@ID";
pID.Value = id;
SqlXmlParameter pFirm = cmd.CreateParameter();
pFirm.Name = "@Firm";
pFirm.Value = firm;
DataSet ds = new DataSet();
ds.ReadXml(cmd.ExecuteXmlReader());
1
(
*
'%3%
*
"
*
&
3 *
(
1
1
2
" NL "
1
*
*
1
"
&
(
/
(
5
;:
*
"
NL $
8
1
*
(5
'%L %/
*
" NL " 3
*
( /
/
1
"
7
"
2*
*
*
5&
' "
SQLXML
165
./.
1
3
(
*
*
1
*
*
*
*
+
1
( *
( +1
*
(
*
( *
&
*
(
*
(
*
*
(
* *
*
/
(
* "
1 ;
(
"
!/
2*
+
(
+
1
*
*
/
2(+
L %/
" ;&
( *
*
*
(
"
"
1
"
5
"
*
; (+
*
/
'%3%
2
1
(+
*
"
*
+1
*
0"0
"
Performantiemeting SQLXML
0.4
Uitvoeringstijd (s)
0.35
0.3
0.25
0.2
0.15
0.1
0.05
0
System.Data.SqlClient
IIS middle-tier
Microsoft.Data.SqlXml
Figuur 5.5 – Performantiemeting templates
;
1
(
*
";
(
*
1
( *
1
L %/ (
+"
"
SQLXML
./=
;
166
&
(
*
(
(
*
(
"
*
1
(
1
*
*
(
+
.8
*
(
2
*
*
( 1
*
*
L %2
!
(
+
"
*
*
/ (
*
2
* ;
1
+
5
(
")
1
";
*
* (
+
"
2
.8!
:
(
L %/
";
*
(
1
*
*
1
<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:sync [mapping-schema= "AnnotatedSchemaFile.xml"] >
<updg:before>
…
</updg:before>
<updg:after>
…
</updg:after>
</updg:sync>
</ROOT>
( *
1
*UU
*
Q
1
R/
^
"
(
"
_/
E
)
& /
*
*
(+
*
(
55
F
'%3%
Q
R/
*
"
1
"
8
2
%/
"
*
7
(
*
* 2*
*
*
*
NL
;
!
*
"
SQLXML
167
.8(
%
(
(
"
;
*
+
*
*
*
;
!/
*
" H
(+
;
!/
*
(+
* N 5
";
*
*
1
/
*
2
1
*
<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:header>
<updg:param name="FirmID"/>
<updg:param name="ID" />
<updg:param name="Price" />
</updg:header>
<updg:sync>
<updg:before>
<Article Firm_x0020_ID="$FirmID" ID="$ID" />
</updg:before>
<updg:after>
<Article Unit_x0020_Price="$Price" />
</updg:after>
</updg:sync>
</ROOT>
+
*
AAaA$
!
"4
Y
XCT
X#
%:LT!
+*
(
( 1
1
*
*
*
1
5
") "
($
(
L %/
"
5
*
L %/
*
L %/
57
(+
*
* 1
;
+
2
1
+
*
") "
($
*
*
*
*
5
* #! =
+
(
1
/
* #! = *
*
";
(
( +
1
( 48"
!
%/
( *
2
0",2 1
(
1
"
*
*
+
+
*
*
*
#
1
"3
1
*
2
"
"
1
*
/
X."-- 1
;
!/
*
*
"
(
*
1
"
"3
0
;:
NL $
*
5
SQLXML
168
E:
F
1
1
+ "
*
$
(
4 *
NL $
2
1
1
1
*
string updg
= new StreamReader(File.OpenRead("ChangePrice.xml")).ReadToEnd();
updg = updg.Replace("$ID", id);
updg = updg.Replace("$FirmID", firm.ToString());
updg = updg.Replace("$Price", price.ToString());
string dsn = "Provider=SQLOLEDB;Server=…;database=…;uid=…;pwd=…";
SqlXmlCommand cmd = new SqlXmlCommand(dsn);
cmd.CommandType = SqlXmlCommandType.UpdateGram;
cmd.CommandText = updg;
cmd.ExecuteNonQuery();
*
(
1
(
E
$
F +
+ 1
2
*
(
NL
"4
"
*
1
*
4
1
(
*
* *
*
1 * 1
(+
!
7 2
1
2
8" )
1
*
*
";
7 K
1
8
HRESULT="0x80004005" Description="XML encoding or decoding error occured
with a SQL object name"
) *
1
(
(
*
(+
E*
F2
(
<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:sync>
<updg:before>
<Article Firm_x0020_ID="$FirmID" ID="$ID" />
</updg:before>
<updg:after>
<Article Unit_x0020_Price="$Price" />
</updg:after>
</updg:sync>
</ROOT>
1
*
+
*
*
+ *
1+
"#
+
1
*
*
1
*
1
(
9
(
(
*
* 1#
1
!
1
SQLXML
169
CREATE VIEW dbo.ArticlePrices
AS
SELECT [Firm ID] AS Firm, ID AS ID, [Unit Price] AS Price
FROM dbo.Article
(
*
/
1
:! #
/
1
<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:sync>
<updg:before>
<ArticlePrices Firm="$FirmID" ID="$ID" />
</updg:before>
<updg:after>
<ArticlePrices Price="$Price" />
</updg:after>
</updg:sync>
</ROOT>
+
E
1
F
+
1+
(
(+
*
'%L %"
;
*
(
*
( *
*
1
(
(
*
5
^
NL
(
4
_/
1
"
1
*
*
*
"
1
*
*
1
+
*
2
*
(
Transaction aborted
*
+
(
+
*
2
(
" #
(
(+
*
#
5
1
3
(
*
1
Empty update, no updatable rows found
.8/
*
KK
* 2
((
1
*
1
"3
2
1
" ; ( +*
*
( "
(
1
*
+
1
:
*
(
*
1
(
*
1
1
N 5*
(
1
N$
"
2
SQLXML
170
1
*
2
"; *
1
* ;
*
*
!1
:
1
5( +
foreach(Update up in updates)
{
string url = "http://bdssrv/gandagas/template/ChangeArticle.xml?ID="
+ up.ID + "&FirmID=" + up.firm.ToString() + "&Price="
+ up.newPrice.ToString() + "&Description="
+ up.newDescription;
new System.Net.WebClient().OpenRead(url).Close();
}
1
1
(
*
KK ^
2
5 _/
*
+
" ; *
5
"L
1
(
(
1
private string GetUpdateGram(Update[] updates)
{
string NS = "urn:schemas-microsoft-com:xml-updategram";
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
XmlTextWriter updateGramWriter = new XmlTextWriter(sw);
updateGramWriter.WriteStartElement("ROOT");
updateGramWriter.WriteAttributeString("xmlns", "updg", null, NS);
foreach(Update u in updates)
{
updateGramWriter.WriteStartElement("sync", NS);
updateGramWriter.WriteStartElement("updg", "before", NS);
updateGramWriter.WriteRaw(GetOld(u));
updateGramWriter.WriteEndElement();
updateGramWriter.WriteStartElement("after", NS);
updateGramWriter.WriteRaw(GetNew(u));
updateGramWriter.WriteEndElement();
updateGramWriter.WriteEndElement();
}
updateGramWriter.WriteEndElement();
updateGramWriter.Close();
return sb.ToString();
}
3
^
_/
*
(
(
+
N *
) 1
1
*
*
(
2(+
*
(
*
^
(
*
:
(
_/
1
/
"# *
/5 (
^
(
(
*
(
7b8
_/
1
5"
(+
N
*
(
1
(
L %/
"
SQLXML
171
private string GetOld(Update u)
{
return "<Articles Firm=\"" + u.firm + "\" ID=\"" + u.ID + "\" />";
}
#
(+
*
1
* 1 *
1
(
#
2
1
(
KK
(
1
(+
(
*
* "
/
*
*
;&
#
*
*
KK
"
N$
/
*
SqlConnection conn = new SqlConnection("server=…;uid=…;pwd=…;database=…");
SqlCommand cmd = new SqlCommand("UPDATE Articles SET [email protected], " +
"[email protected] WHERE [email protected] AND [email protected]", conn);
cmd.Parameters.Add("@Price", SqlDbType.Float);
cmd.Parameters.Add("@ID", SqlDbType.Char, 10);
cmd.Parameters.Add("@Firm", SqlDbType.Int);
cmd.Parameters.Add("@Description", SqlDbType.Char, 30);
conn.Open();
foreach(Update up in updates)
{
cmd.Parameters["@Price"].Value = up.newPrice;
cmd.Parameters["@Description"].Value = up.newDescription;
cmd.Parameters["@ID"].Value = up.ID;
cmd.Parameters["@Firm"].Value = up.firm;
cmd.ExecuteNonQuery();
}
conn.Close();
+
1
* *
*
(
7
*
*
8
+1
* 1#
7 + 8
*
*
1
*
";
(
(
(
*
*
*
1
*
1
"
1
*
* ";
/
"
0"?"
*
(
( #
NL
1+ 2
*
*
(
*
9
*
*
'%3%
(
"
1
SQLXML
172
Performantiemeting SQLXML
40
35
Uitvoeringstijd (s)
30
25
20
15
10
5
0
System.Data.SqlClient
IIS middle-tier
Microsoft.Data.SqlXml
Figuur 5.6 – Performantiemeting updategrams
.88
&
;
*
* +
1
/
/
*
!/ N
*
1
*
(
+
(
1
* 1
(
2
"
1 +( +
+
(
(
2
*
*
NL
(
(
":
1 " ;
+
";
(
*
(
*
"
7
8
*
*
'%L %
(
(
*
7 " 0"G8"
*
"
/
(
1
*
1
1
1
* 1
* 1
1
:"$*
+
*
1
*
*
*
1+
*
*
*
*
*
7
4
8
/
*
(
(
*
*
;
+
+
;
* +*
(
(
*
*
*
*
"
(
1
7
2
8
*
*
*
*
*
"
+
*
E
(
F*
(
"
*
L %
SQLXML
173
..
0
..!
+
L %/
*
*
"
*
1+
1
1
(
*
#
*
"
*
/
*
(
<
"
(
+
1
(
1
# 3")
+
'%L %
*
*
(
(
"
1+
*
*
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<DataInstance>…</DataInstance>
<diffgr:before>…</diffgr:before>
<diffgr:errors>…</diffgr:errors>
</diffgr:diffgram>
^
_( *
" &+
$
((
1+
(
^
+
*
(
"
+
1
+
_2 1
*
+
+
* 1#
+
+
1
1
"
(+
*
(
"3
*
*
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
<GandagasDataSet xmlns="http://www.tempuri.org/GandagasDataSet.xsd">
<Articles diffgr:id="Article1" msdata:rowOrder="0"
diffgr:hasChanges="modified">
<Firm>1</Firm>
<ID>794SC/30 </ID>
<Description>Ontspanner Campinggaz
</Description>
<Price>10</ Price>
</Articles>
</GandagasDataSet>
<diffgr:before>
<Articles diffgr:id="Article1" msdata:rowOrder="0"
xmlns="http://www.tempuri.org/MyDataSet.xsd">
<Firm>1</Firm>
<ID>794SC/30 </ID>
<Description>Ontspanner Campinggaz
</Description>
<Price>5.8999</Price>
</Articles>
</diffgr:before>
</diffgr:diffgram>
SQLXML
174
..(
%
40
;
*
*
*
*
+
*
+
*
(
*
2
")
+"3
*
1
7 "
8
*
/
* "
"
+
(
*
(
"
:
(
#
/
*
%/
(
*
1
*
*
*
"
1+
1
1+
(
(+
1
*
*
$
GandagasDataSet changes = gandagasDataSet1.GetChanges();
3
(+
1+
*
*
2 * 1+
5
*
1
*
&1
"
*
*
*
L
+
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
changes.WriteXml(sw, XmlWriteMode.DiffGram);
string diffgram = sb.ToString();
$
1
*
5
"
*
;:
$
&
/
4 ( *
*
string dsn = "Provider=SQLOLEDB;Server=…;database=…;uid=…;pwd=…";
SqlXmlCommand cmd = new SqlXmlCommand(dsn);
cmd.CommandType = SqlXmlCommandType.DiffGram;
cmd.CommandText = diffgram;
cmd.SchemaPath = schemaPath;
cmd.ExecuteNonQuery();
5
1
*
1
"
*
(
( "
(+
+
*
+
*
(
1
";
(
(
(
* (
1
1
*
21
SQLXML
175
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:element name="Articles" sql:relation="Articles">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Firm" sql:field="Firm"
type="xsd:int" />
<xsd:element name="ID" sql:field="ID"
type="xsd:string" />
<xsd:element name="Description" sql:field="Description"
type="xsd:string" />
<xsd:element name="Price" sql:field="Price"
type="xsd:double" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
;
(
*
"
NL $
NL
1
*
( *
*
;:
4
(
1
DataSet ds = new DataSet();
SqlXmlCommand cmd = new SqlXmlCommand(dsn);
cmd.RootTag = "ROOT";
cmd.CommandText = "Articles";
cmd.CommandType = SqlXmlCommandType.XPath;
cmd.SchemaPath = schemapath;
SqlXmlAdapter ad = new SqlXmlAdapter(cmd);
ad.Fill(ds);
//manipulatie van de data
…
ad.Update(ds);
3
1
*
N 5
"
*
(+ (
*
$
*
(+
1+
../
:1
(
4
*
( 1
, ")
1
*
2
*
"
1
+ *
*
C?"CP
*
*
NL $
" ;
1
"
( +
+
/ (
1
9
*
*
1
*
+
+*
*
NL #
1
1
SQLXML
176
*
+*
C?",,
2*
+(
"
*
*
+
"
1
*
+
*
0"J"
Performantiemeting SQLXML
30
Uitvoeringstijd (s)
25
20
15
10
5
0
Diffgram manueel
Diffgram met SqlXmlAdapter
Updategram
Figuur 5.7 – Diffgrams versus updategrams
3
+ +
(
( *
1
" ; 1
*
1+
* 1
1
" K
*
2
*
82 1
*
1
(
*
"
*
"
&
+ (
*
;
*
1
+
(
/
* 1 (
")
(
"
NL #
*
*
* 1"
*
+
*
KK *
* "
(
2( +
+
(+
(
"; 1
1
*
")
* (
/
/
1
L %/ *
*
1
<
*
+
( *
NL
..8
*
1+
*
*
*
( * 2
7
9
KK
+
1
*
*
(
SQLXML
177
.=
#$:"$
)
(
41
*
2
(
*
'%L % G"(
1 (
*
'%
*
(
*
1 (
*
3#!
"
,--0
+
1
2 1
*
1
*
*
"
.=!
3
&
3#!/
+
*
5
E!
((
F
+
$
/
*
'%L %"
2
";
(
1
'%L %
7
'%L % 5
0",8"
45
*
0"Q *
%/
"3
((
1
(
(
*
*
3#!
*
;
() #
Figuur 5.8 – Configuratie SQLXML webservice
+
!!
1
"
SQLXML
178
+
*
(
'%L % *
3#!/
*
1
=
( *
/
<
2( 1
1
*
*
1
1
+
7
& 81
*
"
5
+
"
*
(
+
*
*
# *
*
1
*
3#!
*
5
(+
N
%/
*
/
*
Internal server error: Error parsing SOAP configfile
1
(
*
(
4
*
"3
(
*
H
(
7 '%,---8
0"Q 1
2
1
1
21
( +*
*
+
'%L %
0
%/
*
@
,
*
1
*
(+
*
1 (
1 (
* 2
*
* /
.=(
/
7
(
*
"
1
*
2*
+
+ <+
(+ (
+ (
2
*
*
<+
"
2
"
*
L %
*
* (
1
N 5/
1+ "
(
+
1 "
"
1
:"$
( 1
/
5
*
*
/
*
*
*
*
*
(
(+
1
1
(
/
2
*
7 " 3& L %8"
* 8*
'%3%
KK
(+
'%
45
"
L %"
%
*
0"P
*
45
1 (
1
*
* ";
*
(
*
*
websvc svc = new websvc();
int ret;
DataSet ds = svc.sp_get_ClientAll(firm, true, out ret);
45
SQLXML
179
Figuur 5.9 – Proxyklasse voor SQLXML webservice
*
'%L %
(
*
%/
*
"#
N
2
(
'%
/5
1 *
*
"
*
<xsd:element name="sp_get_ClientAll">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" maxOccurs="1" name="vFirmID"
type="xsd:int" nillable="true" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
*
1
45
2
1
*
1
"
+ (+
*
*
1
*
"
+
/
* 21
1
-
1
"
.=/ 1
3
(+
*
+
*
*
/ N *
*
*
'%L %/1 (
*
1
*
SqlConnection conn = new SqlConnection("server=…;uid=…;pwd=…;database=…");
SqlCommand cmd = new SqlCommand("sp_get_ClientAll", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@vFirmID", SqlDbType.Int);
cmd.Parameters["@vFirmID"].Value = firm;
SqlDataAdapter adap = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adap.Fill(ds);
*
1 (
*
/
*
*
0"C-"
*
+
*
SQLXML
180
Performantiemeting SQLXML
8
7
Uitvoeringstijd (s)
6
5
4
3
2
1
0
Stored procedure via TDS
SQLXML w eb service
Figuur 5.10 – TDS versus SQLXML-webservices
3
1
(
( *
1 (
.=8
;
"
&
(
(
L %/ (
*
1 (
*
*
1
(
1
* (
"
*
1 (
*
(
+
1
(
*
#
J
*
*
1
1
/
# 3")
.B
*
";
,"-
*
*
*
2
1
"
*
'%
1 (
"
*
1
,--0 7 "
.8"
&
'%L %
*
(
2*
*
/
1
L %
(
1
+
L %" ;
+
(
*
SQLXML
181
*
/
*
(
"
2
'%L %
(
(+
(
*
1
(
/
*
3
*
(
(
4(
(
N
3
1
A
*
+
( 1
*
1
/
*
*
*
(
" ;
*
2
*
( *
*
(
*
"
1
'%L % 7
1K *
1
'%
*
,--0
+
*
(
?8"
*
(
(
1
*
(
1+
1
'%L %
*
(
+
*
"
: 0*
5
1
9
L % 1
+
*
+
5
*
*
*
8
*
*
'%L %
'%L %
(
1/
"
* (
I
"H
* (
7
*
*
"
I
*
'%L %/1 (
/ (
3#!/
(
*
"
*
*
+
"
=
#$
(--. H
=!
H
*
'%
*
*
,--- (
*
(
*
L %/
(
;
!
'%L % G"-" ;
" '%
*
*
(
=!!
'
*
*
(
(
*
1
*
1
*
"5
,
(
*
*
(
* 1
*
,--0"
*
!/
1
;
!/ (
!
1 (
*
/
,( *
*
1
(
(+
*
( *
(+
"5
I
N
'%
(
*
182
*
*
*
,--0" ; ( +
(
*
7
,--0
*
(
2 1
*
'%L % G"-
* * "H
#!
'%
*
*
,--0
N
(
*
;
#
1 (
(
1 L!
*
*
(--/
"
*
,--G
*
*
"
*
1 (
'%
*
'%
(
(
1
(+
8
1 (
"5
*
7
(
*
1 (
(
N
" 52
'%L %
(
H
5
."-2 *
*
'%L % G"-
,--0 (
( +
;
1 (
*
:1 1( (
(
(
*
+
*
*
( *
1
1
2
#!
+
H
(
3#!/
*
*
1
(
*
+"
E
F (+
"
*
1 (
8"
I
* /
SQL Server 2005 Web Services
=!(
;
183
4
(
0 L
*
1
1 (
*
'%
*
*
,--0 *
*
1
" 3
(
1
5(
(+ *
*
1
* (
1
+
/*
*
(
(
*
*
2
" '%
1 *
1
1 (
(
*
/
(
*
(
(
*
1
1
+
1
/
*
*
'%
;
*
1 (
*
1
=
,--0
"
1
*
( +1 1 +
1
.".8" ;
;
/ (
*
(
<
(
*
(
/ (
*
(
2
(
;
!
,--0
/
21
*
!" 3
*
"
(
7
+
*
( +
E F
1 (
%/
1+
*
N 5
1
*
'%
*
*
" ;
*
"
(
(
*
(
3#!
3#! 1 (
* *
,--0 1 (
*
(
+
*
*
(
*
1
'%
*
*
(
(
(
*
+
(
; 1
1 (
*
1+
*
*
*
*
" ;
(
"
+
*
"
2
,--0
/
1
1 (
*
(( 2
(+
*
(
+
"
1 *
*
*
1
1
*
'%
3#!
(
1 (
4/
"
(
/
2
(
1
="
*
/
1
1
*
2
1*
*
SQL Server 2005 Web Services
=(
1
=(!
4
(+
,
184
#
"
*
*
*
1 (
+
";
"5
*
+ ,
) !3 ) 2
'%
1
#!
*
#
*
*
1
(
'%
*
1
N *
(
*
/ '%/
1
*
,--0
*
"
(
1
* 1+
*
'%L % G"-
*
3
*
* "
$& #
*
) /5 4*
,--0 / '%/
"
CREATE ENDPOINT sql_endpoint_gandagas
STATE = STARTED
AS HTTP (
PATH = '/sql/gandagas',
AUTHENTICATION = ( INTEGRATED ),
PORTS = ( CLEAR ),
SITE = 'sql2005'
)
FOR SOAP (
WEBMETHOD 'http://gandagas/'.'GetClients'
( name='gandagas.dbo.GetClients',
schema=STANDARD,
format=ROWSETS_ONLY ),
BATCHES = ENABLED,
WSDL = DEFAULT,
DATABASE = 'gandagas',
NAMESPACE = 'http://gandagas/Clients'
)
GO
*
$
1 (
*
"
1
*
(
(
$
(
"
1
*
CREATE PROCEDURE GetClients AS
SELECT * FROM Client
GO
/ (
(
(
*
*
(
*
(
*
/
*
(
"
*
*
*
SQL Server 2005 Web Services
185
;
1 *
(
"
;F
1
*
(
F
+
1 *
(
(
'%
"
/
(
T
49
*
0
"#
,--0
$ 5"
*
4
1
*
1
"
1
+
+
3!!
# %
"
11
o
*
* !# ; X RA NA
o
5
* #: ; ) $# 3) X 7 )
o
;
!/
Q- * !3&
o
41
"
(
*
74 &
'%L %" ;
%/
*
RA NA
*
1 (
*
"
(
Y
*
,
:&%
(
1
AN
A N"
1
(
"
"
#
((
*
2
*
%(
*
*
"
H 0$
(
/
=
*
*
9
< ;
(
'%/
=" ;
1
* 1
";
AA N,--0 Q-A NA
(
1
(
1
+1
(
$
1 (
1
*
(
"
1
1
*
AA N,--0 Q-A NA
1 (
1 (
+
/
82
X 7$% #&82
*
*
(
*
(
*
*
(
&#
X R N,--0="
(
(
=2
2
+
*
"5
'%
*
,--0" ;
SQL Server 2005 Web Services
=((
7
=((!
7
;
(
*
;
186
!
*
1
*
"
7
(
*
*
+
*
;
1
"
7 "
C.GG *
*
1 (
8"
1
" 3
*
*
1
*
=(((
1 (*
(
*
*
(
*
*
1
!/
*
*
( *
2
(
Q-8
+
;
+
(
&
$
(
& $ V!
*
!3&
'%
*
,--0
L$ ! V !
X 7 %8
*
4
(
*
*
)
(
+
(
*
2
'%
,--0 *
*
*
1
4
1
(
(
+
( + '%
*
,--0
74 &
(
1
(+
;
1
!
1/
0%
"
*
1K
*
( *
5
0
*
*
*
'%/
%"
*
$% #&
"
1/
(
5/
*
"
) %
/
"
*
1
(
(
F" #
%"
(+
*
1/
E
1
# *
%94
*
(
2
1
(
21
*
2 1
1/
1
1
*
"
6 (
"3
(+
SQL Server 2005 Web Services
=((/
187
4
(
(+
'%
((
*
,--0 1
*
(
(
*
"
*
*
(
"
*
(+
/
1
(
2
"
1
*
5
5
2
1
+
*
*
(
"
3
*
E$3)) $ F
(
(
*
(
+
"
5 41
1
*
GRANT CONNECT ON ENDPOINT::sql_endpoint_gandagas TO [DOMAIN\user]
; 1 1
*
(
(
(
*
'%/
2
*
*
"
=((8
*
*
1
1
*
(
*
1
*
(
*
1
1
KK
*
9 7
7
& 8
1
'%,--08
(
(
*
(
1 (
+
(
*
7 '%,---
+" ;
1/
*
C"."C8"
*
* 4
0
'"
*
+ (
*
*
(+
*
WebServiceProxy svc = new WebServiceProxy();
svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
svc.SomeWebMethod();
;
(
*
*
1
+
2
( *
*
# *
5/
1
1+
*
(
*
"
SQL Server 2005 Web Services
188
=(/
=(/!
(--/
(
1
*
")
+
,--G"
1
1
1
'%
*
1 (
*
*
,--0/1 (
(
*
*
(
?"C"
Figuur 6.1 – Add Web Reference in Visual Studio .NET 2003
45
1
N,--02 1
1 *
+
*
sql2005.sql_endpoint_gandagas svc = new sql2005.sql_endpoint_gandagas();
svc.Credentials = new NetworkCredential("user", "password", "domain");
sql2005.SqlRowSet rs = svc.GetClients();
1
*
1 (
C"."C8 *
*
*
&
*
/ (+
*
")
(
";
# *
(
(
5/
(
1
*
/
*
(
1
I
1
7!#!#
2
7
)38 KK
/
I
*
SQL Server 2005 Web Services
"
189
(
1
*
5
") ") 1
$
/
*
H
*
* 1
1
1 (
5 *
% &
*
";
5
*
(+
*
+ *
9
45
";
N,--0" ;9
1
1
"
*
$
1 (
1
" ;
5
*
KK
5
'%
"H
*
* 2
(
"
*
*
( *
1
*
1
,--0/
"
*
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.web.services.dll
Additional information: Method sql_endpoint.sqlbatch can not be reflected.
1 (
")
,--G
=(/(
1
+
*
"
(--.
3
1
*
*
2*
1 (
1
*
*
")
I
,--0
,--G
I
(
*
,--0"
*
sql2005.sql_endpoint_gandagas svc = new sql2005.sql_endpoint_gandagas();
svc.Credentials = new NetworkCredential("user", "password", "domain");
DataSet ds = svc.GetClients();
,--0
*
1 (+
5
*
1 (
1
*
WEBMETHOD 'http://gandagas/'.'GetClients'
( name='gandagas.dbo.GetClients',
schema=STANDARD,
format=ROWSETS_ONLY ),
(
"
*
SQL Server 2005 Web Services
;
(
190
*
T
%/
4 0490
*
(
1
45
KK
(
1
*
'%
2
7*
1
* "
1
*
^4
T9 H
*
+
5_/
$
"
";
F
$J 1
1
N& 1
KK
"
+
=(//
/
(+
1
+
1 ( +(
+
*
,--0
( *
1
2
"
41*
*
*
(
*
7
2
(
*
+"
1
+
(+
X)3) 8 1
( 1
L %/
(
*
(+
'
1
1
3#!
*
3#!/(
4 *
"3
(
8
"
+
(
(
*
*
N
?","
Figuur 6.2 – Tracing van een SOAP-bericht via de SOAP Toolkit Trace Utility
=(/8
+
# $;
5
#$
*
1 (
X )# %
'%L % 7
1
"
(
0",8"
*
(
*
(
*
$ 5=''' 3"
/
SQL Server 2005 Web Services
191
FOR SOAP (
WEBMETHOD 'http://gandagas/'.'GetClients'
( name='gandagas.dbo.GetClients',
schema=STANDARD,
format=ROWSETS_ONLY ),
BATCHES = ENABLED,
;
;
(
1
'%/
*
1 (
*
2
(
+
"
*
(
45
7
*
*
(
"
=8
*
(
*
+ (
*
*
*
sql2005.sql_endpoint svc = new sql2005.sql_endpoint();
svc.Credentials = new NetworkCredential("user", "pass", "domain");
sql2005.SqlParameter[] pars = new sql2005.SqlParameter[0];
object[] o = svc.sqlbatch("SELECT * FROM Transporter", ref pars);
+
(
*
N(
( *
N!
*
(
1
"
1
*
;1
"#
,--0
+ 2
*
/
"
1
*
1
*
5*
45
(+
(
*
?"G"
Figuur 6.3 – Uitvoering van een SQL batch
+ (
3#!
*
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<sql:sqlbatch>
<sql:BatchCommands>
SELECT * FROM Transporter
</sql:BatchCommands>
</sql:sqlbatch>
</soap:Body>
</soap:Envelope>
"
SQL Server 2005 Web Services
3*
192
1
*
*
(
*
=
* (
(
(
*
*
(
1
*
* 1
=(8
*
(+
"
(
(
1
"
1
+
"
1
*
1
+
+
*
+*
3
*
*
*
*
7 "#
C,"0J
*
1 (
(+
*
*
1 (
(
*
(
*
*
*
/
"
,--0
(
1
"
*
(
1 (
4 #8 ( 1
+
*
N *
*
+ 1 (
'%
*
*
2 ( 1
N$
1
*
*
*
"
*
1
*
[WebMethod]
public DataSet GetClients()
{
DataSet ds = new DataSet();
using(SqlConnection conn = new SqlConnection(dsn))
{
SqlCommand cmd = new SqlCommand("GetClients", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adap = new SqlDataAdapter(cmd);
adap.Fill(ds);
}
return ds;
}
1 (
*
1
'%
*
,--0/
<
+
*
1 (
*
*
1
2
1
1
"
2 *
+
* 1
1
*
1
*
1/
"
*
@ /
*
*
(
*
'%
* ,--0"
+*
CG"C0
SQL Server 2005 Web Services
+
*
193
*
1
*
*
+*
N$
,"CP
*
"
1
1
1
*
?"."
Performantietest TDS versus web services
14
Uitvoeringstijd (s)
12
10
8
6
4
2
0
TDS
SQL 2005 Web
Service
ASP.NET Web
Service
Figuur 6.4 – Performantietest webservices versus TDS
;
+
(
*
(
*
,--G 1
*
"
*
+
+
(
1 (
*
(
*
(
+
"
2
1
a. TDS netwerktrace
b. SQL Server 2005 Web Services netwerktrace
Figuur 6.5 - Web Services
*
1
SQL Server 2005 Web Services
3
194
'%
*
1
,--0
(
" ;
*
*
*
$3 !&
1
3) X )# %
$& #
) !3 ) /
CREATE ENDPOINT sql_endpoint_gandagas
STATE = STARTED
AS HTTP (
PATH = '/sql/gandagas',
AUTHENTICATION = ( INTEGRATED ),
PORTS = ( CLEAR ),
SITE = 'sql2005',
COMPRESSION = ENABLED
)
*
+
1
1
2
";
(
(
7
*
-"C
8
1
*
"
+
*
1
1
( +(
*
.*
1
*
1
1 (
#
,"- 7 "
.8"
/
;
/
!AC"C 1
*
4 $" ;
*
*
21
")
?"-
1*
= -*
(+
1
G-[ 1
"
1
!
2
(
*
(+
*
1
/
*
*
<
1
*
'%
3#!
"
(
+
* "3
*
+
*
,--0
+
*
1
*
(+
*
1
1 (
*
*
1
(
*
*
=/
1 (
# 3")
+ "
* 1+
;
1 (
1
(
1
,"-" 3
*
,
*
*
#
" '%
(+
"
*
(
SQL Server 2005 Web Services
195
<soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sqloptions="http://schemas.microsoft.com/sqlserver/2004/SOAP/Options"
>
<sqloptions:sqlSession sessionId="…" timeout="…"/>
</soap:Header>
,
#
1
* *
CREATE ENDPOINT sql_endpoint_gandagas
STATE = STARTED
AS HTTP (
…
)
FOR SOAP (
WEBMETHOD 'http://gandagas/'.'GetClients'
( name='gandagas.dbo.GetClients',
schema=STANDARD,
format=ROWSETS_ONLY ),
SESSIONS = ENABLED,
SESSION_TIMEOUT = 60
…
;
(
*
* +*
(
*
*
7( +
*
8" ;
;
(
1 (
*
/
*
=8
"
*
<
,--0
1 (
4 *
+
*
"
#$:"$
(
*
*
1
3#!2
"
"
1
"
"
(
@
*
(
1
2
9
* *
*
1
'%
(
/
*
*
*
*
* *
*
"
+
/
'%L %2
'%L % *
4(
/
+
* 1
1 L %/
'%
'%
*
*
/
,--0
,--02 ( +
*
(
*
"
; 7
*
( + '%L %2 +
8
1K *
3#!
(
*
*
*
*
;
!*
N 5
"
SQL Server 2005 Web Services
196
'%
+
1 (
3
1 (
*
*
*
,--0
1
*
4(
(
*
*
*
N
(
/(
"
'
*
'%
*
,--0
+
*
#
8
4(
* *
,
1K (
*
";
"
,--0
NL /
() #
5
/*
+
'%L %
*
";
*
(
2
(
9
1
'%L %
2
7KK
% (+
'%
2*
*
*
*
9
*
4(
52 1 1
(
2
*
(
*
/
1
(
*
*
=.
" '%L %
2
"
"
"
&
'%
*
(
,--0
(
*
*
(
(
3#!/
*
(
*
*
*
'%
1
(
*
+( + 7
1
(
9
+
1
2
4*
+ (
2
(
"
*
*
#$:"$
*
*
*
1
1 (
*
*
(
7
*
+
1 2
Q8"
"
#$
( *
/
L %
(+
(
O 1
*
*
*
2
1
*
(
,--0 (
(
!" ; 1
+
*
*
*
;
*
*
1 (
(
/
'%
*
*
*
"
*
*
(
*
(
(
,--0
*
+
* 2
*
*
(
8"
"
(
(--. H
*
*
/
B
41 0
1
B!
1
*
1
3#!2 *
*
( *
*
#
1
*
3#!
! *
(
1 (
/
1
/
*
2
5 5
"H
1+
*
:
/
*
*
1 (
(
*
1 (
7 " 3#8" ;
*
(
(
*
*
*
/
*
*
*
*
3#!
1 (
*
#
"
)
/
*
+
5
0 &
0
# 3")
*
1
" ;
%
"
"
/
*
4(
9
(
*
"
1 (
(
1+
1
*
4
G"
#
1
# 3")
0
*
*
*
( *
+
&
(
*
+
1
*
(
;
";
(
((
B(
(
*
1
(
*
4*
*
2
8
(
(
"
1
*
7
+
*
"
(
7
*
0
8
197
(
(
1
"
(
*
Ontwikkeling van een SOAP Data Provider
0 &
(
*
(
*
2
0 0
198
(
(
9
1
( *
2*
*
"
(
*
*
4
0 1
&
*
4
*
3
*
*
+
1
($
1
*
2
*
3#!
*
*
! *
($
= *
1+
"
* 1
"
+ 2
5
(
*
"
"
*
( 1
*
*
($
(
(
5
/
(
(
0 0
*
"
1
"$
( *
"
*
*
(
(
*
(
"
B/
B/!
3
&
* (
1 (
*
*
5
*
1
(
*
3'
3#!/(
"
1 (
9
+
2
*
5
;
$
*
45
!
public SoapConnection(SoapHttpClientProtocol svc)
3
*
1 (
1
(
*
2 (+
*
*
$
+
$
/*
*
=2
7
J"G".8"
(
connector = new SoapConnector(svc);
(
$
*
(
+
*
"
*
*
2 1
*
* +
*
:&%
Ontwikkeling van een SOAP Data Provider
199
public string ConnectionString
{
get
{
return connector.Proxy.Url;
}
set
{
connector.Proxy.Url = value;
}
}
1
;
5
!/
1
3
(
$
*
2
1
"
1 (
1
*
*
3
*
*
(
"
$
*
public void Open()
{
state = ConnectionState.Open;
}
public void Close()
{
state = ConnectionState.Closed;
}
($
*
$
$
"
5
* *
($
/ (+
($
#! 1
(
5
2* (
1
1
1
5
+
$
IDbCommand IDbConnection.CreateCommand()
{
SoapCommand cmd = new SoapCommand();
cmd.Connection = this;
return cmd;
}
public SoapCommand CreateCommand()
{
SoapCommand cmd = new SoapCommand();
cmd.Connection = this;
return cmd;
}
1
(
1+ *
* (
1
*
* *
1
*
2*
*
*
"
Ontwikkeling van een SOAP Data Provider
200
B/(
7
8(
+
*
"
*
1
.(
*
1 "
1 (
1 (
E
*
(
+
(
#!
(
1
*
1K
F*
1
1
7
Q"08"
&
$
(
*
*
1 (
"3
5
1 (
$
*
(
2
"
("
*
1 (
21
(+
*
*
1
"
(
"3
(
*
*
*
*
*
2
*
*
1 (
/
1 (
( +1
"3
(
B//
* 1 (
*
1
*
*
"
*
45
"
+
/
*
public SoapCommand();
public SoapCommand(SoapMethod);
public SoapCommand(string);
public SoapCommand(SoapMethod, SoapConnection);
public SoapCommand(string, SoapConnection);
public SoapCommand(SoapMethod, SoapConnection, SoapTransaction);
public SoapCommand(string, SoapConnection, SoapTransaction);
*
$
!
+
*
$
4
*
7
+
*
* +
J"G"?8
1 (
*
public int ExecuteNonQuery();
public SoapDataReader ExecuteReader();
public SoapDataReader ExecuteReader(CommandBehavior);
public object ExecuteScalar();
*
"
"
5
+
Ontwikkeling van een SOAP Data Provider
201
N
+
*
"
*
$
SoapConnector.SoapResultSet rs = conn.Connector.Execute(this);
B/8
&
(
+
*
1 (
(
1
*
"3
&
class SoapResultSet
{
public int recordsAffected;
public DataTable data;
}
(
( 7
(
*
KK *
8
1
1
4
#
(
4
1
)
1 (
*
45
*
"$
&
4
$
*
*
$
'
(
2
5/
1+
$
*
*
"
((
*
public SoapConnector(SoapHttpClientProtocol svc)
{
this.svc = svc;
}
$
$
1
<
"
*
(+
*
*
* (
$
2
object[] o = new object[command.Parameters.Count];
int i = 0;
foreach(object p in command.Parameters)
{
SoapParameter par = (SoapParameter) p;
o[i++] = par.Value;
}
2*
*
4
Ontwikkeling van een SOAP Data Provider
202
2
1
*
45
";
2
(
1 (
1
object res = svc.GetType().GetMethod(command.CommandText).Invoke(svc, o);
*
(
*
4
5
*
$
$
( *
1
"
5$
2(
;
*
/
*
*
* *
(
"
*
5
1
*
(
*
5
1
SoapResultSet rs = new SoapResultSet();
if (res is DataSet)
rs.data = (res as DataSet).Tables[0];
else if (res is DataTable)
rs.data = (res as DataTable);
else if (res is int)
rs.recordsAffected = (int) res;
else
throw new InvalidOperationException();
:
+1
B/.
*
"
1
!
(
+
(
1
*
"
DbType type
*
(
(
*
bool nullable
*
*
M
7
A
8M
1
*
string col
*
M
M
(
DataRowVersion drv
1
*
+
ParameterDirection dir
object val
*
5 *
string par
*
*
/
"
*
1
1
*
$
1
(
1 (
(+
4 *
*
45
&
*
+
"
1+
(+
M
M
Ontwikkeling van een SOAP Data Provider
B/=
1
203
&
5 1
$
"
(
1
*
1 (
*
1
*
*
!
$
7
*
J"G".8" 3
*
*
5 #
*
5%
public class SoapParameterCollection : ArrayList, IDataParameterCollection
3
+
4
2 1
(
public
public
public
public
public
public
object this[string index];
bool Contains(string parameterName);
int IndexOf(string parameterName);
void RemoveAt(string parameterName);
override int Add(object val);
int Add(SoapParameter val);
*
B/B
1
0
:
*
4
+ +1
(
(+
+
2
(
+
*
1
")
*
*
*
#
* ";
/
"
1
4
"$
*
(
(
2 1+
* +
5
*
#
$
1
1
*
"
*
"
( *
"
(
" (
#
1
2
*
public event SoapRowUpdatingEventHandler RowUpdating;
public event SoapRowUpdatedEventHandler RowUpdated;
*
*
+
public
public
public
public
*
SoapCommand
SoapCommand
SoapCommand
SoapCommand
#
*
SelectCommand;
InsertCommand;
UpdateCommand;
DeleteCommand;
1
$
=
*
(
"
2
Ontwikkeling van een SOAP Data Provider
B8
%
B8!
H
3
#
(
204
2(
*
1
*
"$
*
1 (
N$
2*
N
#
*
(+
*
(
N$
/ (+
*
1
*
1
*
"
+
* 2
*
*
( 1
(
/ (+
1 (
*
4
1
*
*
(
*
2
+ 1 (
1
*
*
*
[WebMethod]
public SoapSampleDatabase GetProducts();
[WebMethod]
public int InsertProduct(string name, decimal price);
[WebMethod]
public int UpdateProduct(int id, string name, decimal price);
[WebMethod]
public int DeleteProduct(int id);
#
(
(+
N
"
*
!
N
#
55
1
*
2
+
1
B8(
;
(
*
*
+"
7
<
1
82
!
G"?".82
* 1
I (+
*
*
*
1
1 (
4
( *
(
*
"
*
"
!
/
.
(
*
#
*
/
"
,
I
55
:
57
1
*
/
1 (
1 (
H
N$
7
*
(
/
"
*
(
#
"
(
+
8
(
*
*
Ontwikkeling van een SOAP Data Provider
205
Figuur 7.1 – Add Web Reference dialoogvenster
*
(
*
*
conn = new SoapConnection(new ProductsService());
adap = new SoapDataAdapter();
adap.SelectCommand = new SoapCommand("GetProducts", conn);
adap.InsertCommand = new SoapCommand("InsertProduct", conn);
adap.InsertCommand.Parameters.Add(
new SoapParameter("@ProductName", DbType.String, "productname"));
adap.InsertCommand.Parameters.Add(
new SoapParameter("@Price", DbType.Decimal, "price"));
*
(
+
#
*
(+
5
"3
:
#
1
1
/
2 1
1 (
(
$
$
*
1
1
*
$
"
*
1
* +
*
(+
*
+
(
5
(( "
5 5
5
9
2
* *
1
*
2 1
J","
Ontwikkeling van een SOAP Data Provider
206
Figuur 7.2 – Strongly typed DataSets
:
+
2
*
(+
(
( !
3
*
( 1
*
+
V%
(
9
(
*
1
"
+
2 *
*
adap.Fill(soapSampleDatabase1, "Products");
;
1
( !
*
+
1 (
*
*
*
*
1
*
*
2
(+
*
(
7
1
*
C8
*
"
*
1
*
(
7
:
*
(
*
1
adap.Update(soapSampleDatabase1.Products);
*
$
/ (
G"?
0"08" 3
1+
#
/
"
*
E:
F/
Ontwikkeling van een SOAP Data Provider
207
B.
B.!
7
#
@
*
1
$
(
*
*
*
/ (+
(+
*
(
(
N
*
#
1
(
*
K *
E
#/
*
1
*
/
*
*
(
45
(
+
1
C $
*
(
(
(
*
"
*
7 "1
*
(
/:&
(+
*
1+
2
/ (+ "
(
( 1
"
45
+
%/
45
"$
1
"
*
*
#
0
("
1 (
(
%/
0
5
+
+
+
/
1
" 4 8" ;
*
1
1
*
1
*
*
*
$
/
*
((
*
1
")
*
*
( 1
"
*
*
"
* *
+1
1 (
2 1
3#/
1 (
*
*
"3
*
*
+
*
"
F
/
*
1
(
1 (
(+
5
1
(
(
*
#
"
5
1
#
(+
&
&
2
"
WebClient webclient = new WebClient();
ServiceDescription myServiceDescription =
ServiceDescription.Read(webclient.OpenRead(wsdlUrl));
ServiceDescriptionImporter i = new ServiceDescriptionImporter();
i.ProtocolName = "Soap";
i.AddServiceDescription(myServiceDescription, "", "");
/
Ontwikkeling van een SOAP Data Provider
208
CodeNamespace namespace = new CodeNamespace(ServiceDescription.Namespace);
CodeCompileUnit unit = new CodeCompileUnit();
CodeNamespaceCollection code = unit.Namespaces;
code.Add(namespace);
ServiceDescriptionImportWarnings warnings = i.Import(namespace, unit);
,
1 (
*
*
0
*
"
*
I
(
4
1 (
H
*
7
1 (
"
1
I
*
+
E
*
+ (
*
(
+
F
"
*
(
*
[WebServiceBinding(Name="Select")]
public class Service1 : System.Web.Services.WebService
{
…
[WebMethod]
[SoapDocumentMethod(Binding="Select")]
public SoapSampleDatabase GetProducts()
{
…
}
…
}
45
*
!
(
1 (
*
"
*
+
+
(
2 :
I
*
I
/
(+
*
*
(
1
"
*
*
*
1
7
*
*
1
" 4
*
1
1
1+ (
*
(
45
*
C8
1
( 5"
G
)
*
#
*
9
*
#
*
/
$
/ (+
*
"
Ontwikkeling van een SOAP Data Provider
*
7
*
2
2:
1 (
209
2
8 ( * KK
"
*
5
*
1
private MethodInfo GetSynchronousMethod(Type type)
{
MethodInfo result = null;
foreach (MethodInfo i in type.GetMethods())
{
if (i.DeclaringType == type && IsSynchronous(i))
{
result = i;
break;
}
}
return result;
}
private bool IsSynchronous(MethodInfo i)
{
foreach (ParameterInfo p in i.GetParameters())
if (p.ParameterType == typeof(AsyncCallback)
|| p.ParameterType == typeof(IAsyncResult))
return false;
return true;
}
*
(
*
(
$
1
5
5
/
private void WriteCode(StringWriter sw, Type type, string s)
{
sw.WriteLine(
"SoapConnection conn{0} = new SoapConnection(new {1}());",
s, type.FullName);
MethodInfo i = GetSynchronousMethod(type);
sw.WriteLine(
"SoapCommand {0} = new SoapCommand(\"{1}\", conn{0});",
s, i.Name);
foreach (ParameterInfo p in i.GetParameters())
{
string ts = p.ParameterType.Name;
sw.WriteLine(
"{0}.Parameters.Add(new SoapParameter(\"@{1}\",
DbType.{2}, \"{1}\"));", s, p.Name, ts);
}
sw.WriteLine(
"adap.{0}Command = {1};",
s[0].ToString().ToUpper() + s.Substring(1), s);
sw.WriteLine();
}
Ontwikkeling van een SOAP Data Provider
210
1
/ (+
$O/
1
*
( *
1
$
"
1
1
( *
(
*
+
5 *
*
* "
*
* 1
$
(
1 "
(
*
*
( *
*
/
#
/
*
Assembly a = Assembly.LoadFile(proxyAssemblyPath);
StringWriter sw = new StringWriter();
sw.WriteLine("SoapDataAdapter adap = new SoapDataAdapter();");
WriteCode(sw, a.GetType("Select"), "select");
WriteCode(sw, a.GetType("Update"), "update");
WriteCode(sw, a.GetType("Delete"), "delete");
WriteCode(sw, a.GetType("Insert"), "insert");
string code = sw.ToString();
7
(
7
@
( *
(
2
2
2:
*
1 (
8" ; 1
45
*
:
";
+
2
(
*
8
+
KK
#
(
*
2(
(
KK
KK 1 (
2
(
*
#
/ (+
(
*
7
2
/
1
2
"
(
( "
.
*
*
+
C"
45
," %
(5
G"
*
*
*
1 (
*
(
(
")
( 5"
/
1*
*
#
." 6
"
$
="
"
1
45/
( 52
9
J"G
(
(
*
1 *
+
2*
#
*
" ;
1
7
*
*
Ontwikkeling van een SOAP Data Provider
8
:
211
1
/
(
#
/
2
1
*
*
/
"
Figuur 7.3 – Voorbeeld van een SoapDataAdapter Code Generator
1
1+
*
*
B.(
1 (
9
U
*
1
1
*
<
/
(
1
1
# 3")
*
+
" #
*
*
(
*
*
N
"
@
*
1 (
1
2
2
Z
(
(+
*
+ 1
(
2
"; (+
*
45
1 (
(
7
"$
C
*
*
*
*
"
82
*
*
;
(
#
"
2
1
"
(
*
1 *
*
,"-" 3
( *
1
*
"
Ontwikkeling van een SOAP Data Provider
212
,--0
."CC8 ( *
1
*
1 (
1E
F
*
7
"
(
/
1
(
+
*
#
1
/
"
/
(
*
*
$
*
"
&
"
*
(
#
*
3#!
*
"
"
1
/
8"
<
KK
*
*
"
*
(
1
(
*
(
1
*
*
*
(
"
(
(
\
1
/
*
F
(
(
"
K
*
(
1
*
*
/
:& I
"
*
(
((
1
45
*
(
(( " $
45
1
$ () #
1 (
1+
2
1 1
/
$
E
*
2
(
($
+
(
0
1
*
+ 1+
*
*
"
&
*
I*
1 (
*
*
*
*
$
(
1
*
."C-", *
1 (
( * "
(
7 "
50
(
1 (
*
1
*
(
1
2
,"- 1
2
1
"
+
(
+ +
# 3")
( &
/
*
";
*
1
&
1
+
&
*
1
/
"
(
(]/
*
+ 1 (
*
( *
(
(
(
* 2
+
1+
5
7
! *
*
(( 1
*
/
0
( 8"
1 (
"
*
$
*
(
*
45
*
+ (
'
*
1
(+
"
*
Ontwikkeling van een SOAP Data Provider
(
*
*
# 3")
#
2*
1
*
,"-2
."08"
*
(+
:
213
$
/
(
*
*
8
(
*
+
+
/
$
(
7
1
/
1
( 9
*
/
" H
(
"
"$
( +2
5
1
!/* (
(
5
:
(
;
#
5
7
(
1 (
" (
(
#
*
*
(
*
*
/
"
# /
*
7
."?8"
*
+
))
& "V &
!
(
(
*
(
1
" $3 >
*
1
(+
1
E
3
(
(
1
1
H
O
(
*
+ * ( + *
/
K
3(+
(
"
$3 >
" $3
KK
1
")
(
(
I
*
,--G"
I
*
1
*
$3 >
*
C"0
4 *
*
*
*
E
(
5
F
1
1
*
*
(
214
$3 >/
*
*
@
+
1 L!
"
$3 > (
1
(
1
(
2
$3 "
(
")
*
*
")
1
*
1
*
2 $3 >
*
$3 2
")
(
"
$3 >
+1
*
* *
1
"
*
1
*
*
1
E$3 >F
(
*
1
1
7
L
1
$3 >
1
8" ;
(+
*
$
$3 >
*
F2
+ (
(
*
/
(
*
!!
*
M
(+
*
1
*
COM+ Component Services
215
A * *
(
8
+1
*
*
(+
(
4
1
(
+*
(
M
7
1
(
8
+
M
'
5
+
$
M
'
(
A (
1
9
*
'
(
(
(
")
4 *
*
/
*
"
1
2
+ +8
*
"
(
/(
(
$3 >/
*
(
1
1+ *
1
*
"
1
*
*
"
'
1
*
(5 5
5
1
* 8 ( *
& "V
*
#
/
(+
(
(
7
(!
M
$3 / +
*
1
*
(
1
1
7
")
1
* 7
1
*
+
(
*
( /
+
(
*
" ;
1
*
(
$3 >
7
*
( 1
#
*
*
"
(+
*
"
"
*
$3 >/
2
*
(
(
")
(
2
*
1
*
*
using System.EnterpriseServices;
class MyServicedComponent : ServicedComponent { … }
" ;
1
&
*
"
COM+ Component Services
(
216
$3 >/
*
(
((
*
1
"
*
1
"
9
)
1
*
"
*
+
1
1
(
#
*
" 4
(5
"
#Genereren van een strong name key:
>sn –k key.snk
[assembly: AssemblyKeyFile("key.snk")]
*
1
*
!)+>
(
* " 4
#Registratie in de COM+ catalog
>regsvcs.exe MyServicedComponent.dll
; (+1
$3 /( (
*
*
*
5
*
+
1
1
"
* *
*
+
1
*
"
*
"
$3 >/
(
*
*
1
*
"
+
1
1
(+
5
*
*
3
8
1
*
1
4
" $3 > (
1
4
*
7( +
<
*
5
(
0
5
'/
4
1
"3
8
*
1
";
7
*
5/
5
5/
5
")
*
(
* /
*
*
*
*
")
'
1
1
(
Voor client-side applicaties en ASP.NET-applicaties is xcopy-deployment echter in hogere mate gerealiseerd.
/
COM+ Component Services
217
( 51
*
*
5
)
*
1
+
1
";
(
2
1 *
5
I
*
(
1
+
I
(
+
(+
")
*
1 (
*
(
B
(
2
(+
*
D/
$3 >/
+
(
(
(
1
*
1
*
*
*
*
+
(
*
#
B#
( 5#
B#
( 5#
(5
B#
$3 > *
D*
*
(
*
# *
:
=
3
"% (
57
8
*
2
$3 >
1
M
(
# *
3
")
*
2
"
*
7
*
8"
*
*
1
+
*
1
<
"
(
*
*
" 4 /
1
*
"
*
(
*
*
(
$3 8M
D1
1
(
*
(+
:
*
(
(
*
1
# *
#
";
(
D
( 5#
1 (
1
'*
"
*
1
(
)
7 "
*
"
0
;
*
(
1
"
(/
(
$ !
*
*
*
1
*
*
(
/
"
*
(
+
"
(+ (
*
COM+ Component Services
218
/
& "V*
1
* (
*
1
7 5
7")
*
"
2 ")
&
(
*
+
(
2
1
$3 >/
=
(
*
")
*
1
*
(
*
*
/
*
$3 /
")
/
(
(
")
&
'
7
(
8"
(
"
+
+
5
"
4(
(
")
1
*
"
(
*
1
"3
*
(
*
(
1 *
1
+
<
*
1
8
21
$3 >/
*
+ ;
/1 5/
+
(
5
")
82
*
41
L %
*
*
*
$3 > 1
$3 > C"0
# !")
(
*
")
1
+
"
5
+
3#! *
")
2 1 (
(
'7(
#
&
$3 >/
$3 > *
(
*
*
*
*
$3 > *
*
The overwhelmingly positive benefits COM+ offered to COM development aren’t so overwhelmingly positive in
.NET. … Using COM+ effectively in .NET means knowing where COM+ can truly provide a benefit that the
CLR can’t – and how to integrate it into the service provider model with XML Web Services and .NET Remoting
(Bron: [18] blz. 326).
/!
@
/!!
+ (
(
(+
*
# 3")
*
((
1
*
(
$3 >
"%
1
1
*
*
# 3")
COM+ Component Services
219
2 *
(
"
3(+
*
*
(
*
*
"
(
(
3(+
+
(+ *
"
7
5
2
1
*
1
"
*
8
<
(
7( +
*
1
(
*
(
5
1
"
4
*
(
1
*
(+
using System.EnterpriseServices;
[ObjectPooling]
class MyPooledObject : ServicedComponent, IDisposable
{
public MyPooledObject()
{
//initialisatie met hoge systeembelasting
}
//...
protected override boolean CanBePooled()
{
//code voor conditionele pooling
}
public void Dispose()
{
//zorgt voor teruggave aan de pool
}
}
"
"; (+
(
1
(+
(+
*
7
(+
+
KK
*
(+
1
/!(
+
*
+
'
+
*
*
*
82 * *
(+
/
*
(
1
1
"
(+
*
*
(
(+
<
*
*
(
8" ;
COM+ Component Services
;
*
1
";
220
(
/
1
*
(+
/
(
(
*
*
(+
*
(+
(
"
(
*
$O
( 1
//Constructie van het object via achterliggende COM+ object-pool
using (MyPooledObject o = new MyPooledObject())
{
//gebruik van o
}
$
!
/
1
(+
*
7
1
(+
1
9
(+
*
(
7
* 8
*
$
(
1
8
1
*
"
(
21
(
"
(
*
(
*
*
"
/!/
*
(
(+
*
(+ "
(
*
1
*
(
(
":
*
*
(
* *
*
1
*
"
+
5
*
+ 1
(
* (
1
1
"
*
*
(+ 1
+
"
*
$
*
# 3")
!
/
2
+
*
,"-
1
*
+1
(
(
+
8"
1+
#
(
*
+
7*
1
(+
*
1
(
1+
1
"
*
7
81 "
1
COM+ Component Services
/(
221
A * *
/(!
@ / /
*
7
2
@
* 1
(+
2
*
*
@ / /
(+
*
* 1
(+
*
(
*
(+
";
(
*
8
E * F *
1
*
*
*
KK
"
(+ (
/((
*
*
*
7
1
(+
(+
1
71
(
+ (
2
$3 >/
(
(+ (
*
*
8
*
1
9
8" ;
(
*
*
(+
*
( +
* "
4
*
(
1
*
+ / /
*
*
using System.EnterpriseServices;
[JustInTimeActivation]
class MyJittedObject : ServicedComponent
{
public MyJittedObject()
{
//initialisatie
}
[AutoComplete]
public void DoWork()
{
//uitvoeren van werk en destructie van het object
}
}
H
@
1
(
*
"
@
*
*
(
*
1
*
(+ 7
(
"
(
81
*
B#
$
*
* +
* "
D
*
COM+ Component Services
/(/
%
(
*
;
1
@
*
L %
+
222
$3 >
(
*
1
")
&
(
/
")
(
2
(+
"
@
/1
*
*
"
*
*
(
* +1 (
1
/
"
(
@
*
*
(+
(
*
(+
1
*
*
1
*
"
(
1
@
1
(
*
*
* +* *
1
+2
//
1
*
$
@
*
"
!
/
(+
81
(+
"
* 1
*
L %
(
(+
1
7
"
+2
*
1
@
1
*
(
*
+"
*
2
")
1
1
@
&
E
*
*
*
*
")
*
F(
"
4
//!
*
4
$3 > KK
# 3")
(
<
(+ *
+*
+#
*
(
$3 >2
1
+ *
(
*
*
(
*
$
(
*
$
*
$3 >/
/
*
"
" #
1
$3 >
1
0 &7
*
*
*
((
"
82
*
COM+ Component Services
$3 >/
223
+*
*
(+
KK
5
"
*
1
(
" $3 >
N
(
1
4
*
1 *
*
+
2
((
*
"
//(
4
1
1
(
*
$3 >
<
* "
1
1
I
1
*
(+
(
*
+
*
*
(
3
*
"
*
( + (
*
1
*
(
4
* "
(
1
*
(
(
/ (
B
D
I
+
*
(
(
(
$3 >
(
*
1+
"
*
using System.EnterpriseServices;
[Transaction(TransactionOption.Required)]
class MyTransactionObject : ServicedComponent
{
[AutoComplete]
public void CommitChanges()
{
//uitvoeren van werk en automatische commit van de transactie
}
}
/
*
B
D/
"
(
&N
*
1
4
1
(+ (
+
&N
1
(
) 17
*
"
"
*
(
*
* 1
1
1
+
"#
+
7
*
1
+
82 )
4
8
(
7 (+
8"
COM+ Component Services
;
(
*
*
&
7
(
*
W4
224
X
*
8*
"
"
1
&
32
(+
1
*
1
1
+
# 52 &
:
*
2 &
$
$
*
(
(
8"
(
5
4
1
#(
(
+
/
(
*
(+
( 9
*
"'
5
+
*
7$
H
(+
B
2
2 &
( &
";
*
(
*
"
(+
D
[Transaction(TransactionOption=…, Isolation=…)]
///
%
1
1
*
/
(
/
1
*
1 (
(
(
1 (
*
+*
*
3#/
4
*
" K
+
1
*
" ;
<
*
( 1
" $3 >
+
E1
/
*
1 (
1 (
1 (
(+
1
4";
F*
1
1
*
*
1
[WebMethod(TransactionOption=TransactionOption.RequiresNew]
(
1 (
1
*
(
1 (
1
8"
*
E(5
@ /
(
(
B#
F
*
*
;
$
*
!/
7 *
D/
3#! *
(+ *
(( "
1 (
* (
;
*
*
/
(+ "
1
*
781
1 (
*
I*
7
!
(
3#/
8
I(
COM+ Component Services
"
225
* 1
1
# 3")
*
//8
7
40
(
*
2
";
# 3")
")
1
(
* *
,"-2
,"- ( *
*
* * "
*
*
1
( + " 3*
W
(
2
+
(
*
+
+ *
* 1
(
1
2
1
+
# 3")
,"-
(
E*
(
";
(+
*
*
(
(
+
*
(( 2
*
*
*
(
0 & 1
+ ";
(
(
1
1
*
*
,"-
(
1
*
$3 > *
# 3")
"
1
"
(
(
2
'
*
/1
(
0 &
(
")
!
"
12 1
*
$3 >
8"
1
$3 >
2(
( -1
1
!
/
1
*
1+
*
F"
2
( +
(
*
(
+"
*
using System.Transactions;
using System.Data.SqlClient;
class PromotableTransactionsSample
{
public void Do()
{
//transactionele scope aanmaken
using (TransactionScope scope = new TransactionScope(
TransactionScopeOptions.RequiresNew))
{
//connectie opzetten
SqlConnection conn1 = new SqlConnection(dsn);
conn1.Open();
//gebruik van conn1, nog steeds in een lokale transactie
…
COM+ Component Services
226
if (somecondition)
{
//tweede connectie opzetten
SqlConnection conn2 = new SqlConnection(dsn);
conn2.Open();
//promotie naar een DTC transactie
…
}
//commit transactie, al dan niet lokaal of gedistribueerd
scope.Complete(); //werkwijze vanaf beta 2
}
}
}
1
1+ (
+ (
*
*
5
KK
*
(
;
*
*
(
(
KK
/
5
(
*
(
"
(+
*
"
$
1
2
"
(
1
"
'2 # 3")
+
D " 76
#
(( "
(
1
1
2
"
8
*
*
"
$
21
"
"
/
3
*
1
$1
1
(
1
2
"
*
,"-2 '%
(
*
5
%
*
8
3
, 7
)
4*
8"
&
*
1 *
*
*
$3 >
Enterprise services are like medicine: If you don’t need them, you should avoid them. But if you need them, you
really need them. (Bron: [5], blz. 20)
COM+ Component Services
(
227
*
$3 >
$3 > *
1
2 (
* 1
(
(
+
5
(
*
*
(
1
"
")
$3 >
+
*
*
1
*
2*
1 (
6
"
$3 >" #
1
( + "
(
$3 > 1
,"-"
* (
*
1
*
8
KK
"
#
(
1
(
2
I$
)
(
(
(
+1
*
(
1
*
*
*
(+
*
1
*
(
2*
*
/
"
+
2(
1
1
*
*
1
*
*
*
*
7 " '%
1
"
"
*
(
21
8
7 "
+
1+
(
*
(+ *
5
7 " # !")
* 82
/
"
" H
1 (
(
*
*
5
8
+ *
((
+
;
"
1
(
/ (+
*
C
:"$ H
C!
*
(
*
(
(
*
3#! *
1
1
1
*
( 1
1 (
(
*
(
(
(
*
*
1 (
*
*
(
(
"
*
"
3#/
+
*
* 1+
1
* 1
"
C(
(
*
+
+
(
"
1
(
228
+
7
8
*
XML Web Services
229
5
1 (
*
5
2
*
1 (
(
%
8
(
*
3(+
#
!
1 (
8
(
*
(
*
*
1 (
7: *
2
* 5
200
*
1 (
3#!/
1
!
$!
5
(
(
1 (
(
5
"
*
*
*
8
E
2(+
*
1 (
1 (
*
F *
*
*
;
"
!2
*
3#!/(
*
1
M
"H ( *
+
(
8 L %/ (
*
(
1
*
(
%
*
*
M
(
+
*
1
M
H 0$ 7
1 (
*
$
41 7
C/
#"
+
:"$ 7 L
;
*
1
2
+(
(
2
2
"
4
*
1 (
*
(
*
/ (
1 (
*
* +
* 2*
1
# !")
/(
*
<%@ WebService Language="C#" Class="Demo" %>
using System;
using System.Web.Services;
[WebService(Namespace="http://ugent.be/testservice")]
public class Demo
{
[WebMethod]
public int Add(int a, int b)
{
return a + b;
}
}
*
"
*
4
"
4"
XML Web Services
230
*
1 (
1 (
KK
1 (
*
1
(
5 "
1 (
1 (
/
+
&!$/
((
1 (
*
3# 1
7
8"
(
*
* "
"
*
2
*
4
1
";
1
1
*
"
4/(
*
# !")
*
/
9
1 (
1
1
*
;
/
!
N
*
*
1 (
*
* ;
!/
Figuur 8.1 – Webservice testpagina
;
*
*
*
1+
*
1
*
3#!/(
"
"
+
+
*
*
*
1 (
*
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Add xmlns="http://ugent.be/testservice">
<a>int</a>
<b>int</b>
</Add>
</soap:Body>
</soap:Envelope>
XML Web Services
1 (
231
*
1
1
1 (
(
*
1
*
1 (
4
*
2
/
*
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AddResponse xmlns="http://ugent.be/testservice">
<AddResult>int</AddResult>
</AddResponse>
</soap:Body>
</soap:Envelope>
*
1
"
5 *
1
(
*
*
*
( *
*
)
9
*
/
1 (
2
+
*
1
(
55
/
"
!
(
8
"
1
";
*
*
1
(
1
3'
+
7
*
(
*
(
1 (
*
*
45
* (
*
1 (
*
*
";
3#!/ (
"
Figuur 8.2 – XML Web Service Lifetime (Bron: .NET Framework SDK)
*
XML Web Services
;
232
*
*
45
1
/
"
3
(
")
1
6" ;
(
*
*
>wsdl http://localhost/newfile.asmx?WSDL
; ( +1
1 (
*
:&% *
1
# !")
Y
( 1
(
1
1 " )
*
%
*
/
* "
*
*
*
1 (
*
*
%/
( *
*
45
*
1
* " 3 (
*
*
/
N 5
1
*
1 (
+
(
1
"
*
*
1
1
45
(
" " ;
*
[System.Web.Services.WebServiceBindingAttribute(…)]
public class Test : System.Web.Services.Protocols.SoapHttpClientProtocol
{
public Test()
{
this.Url = "http://localhost/newfile.asmx";
}
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(…)]
public int Add(int a, int b)
{
object[] results = this.Invoke("Add", new object[] {a, b});
return ((int)(results[0]));
}
public System.IAsyncResult BeginAdd(int a, int b, System.AsyncCallback
callback, object asyncState)
{
return this.BeginInvoke("Add", new object[] {a, b},
callback, asyncState);
}
public int EndAdd(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
45
(
*
5
"
";
1
"
("
*
"!
#
"
*
;
(
"
*
1
1 (
(
!
"
*
*
$
'
*
#
#
XML Web Services
+
233
'
1
";
1
(
1
*
*
1
1 (
*
";
(
*
*
void CallWebService()
{
Test proxy = new Test();
proxy.BeginAdd(1, 2, new AsyncCallback(Finished), proxy);
//uitvoering gaat verder zonder te wachten op een antwoord
}
void Finished(IAsyncResult ar)
{
Test proxy = (Test) ar.AsyncState;
int sum = proxy.EndAdd(ar);
}
;
5
(+
3
* 1
(
*
1
*
*
( 1
1
*
*
+
*
5
*
45
(&
"
1 (
2
"
#
E#
/
F"
1
*
1+
*
1
1
*
*
< "
C8
# !")
L %
+
(
*
+ *
1
*
1
(
1
*
";
* 1
(+
(
*
*
")
&
*
[WebMethod(EnableSession=true)]
public void SomeWebMethod() { … }
1
"
(#'-
(
*
(+
*
+ Q"Q
1 (
!
*
1
1
*
;
8" ;
*
2
+
* (
*
45
"
;
!" #
7
+ *
*
(
;
"
+2
*
*
2
+1 (
1 (
(
(+
(
*
1 (
*
*
";
XML Web Services
234
(
(+
*
(
(+
*
*
*
# !")
*
(+
/1 (
1 (
*
"
*
2
*
+
(
+
;
!
*
4 4
/
SomeProxy proxy = new SomeProxy();
proxy.CookieContainer = new System.Net.CookieContainer();
;
(
1 (
*
*
* 1
/
(+
2
1
/
*
;
!/
3#!"
2
(
* "
+
/
*
(
(
*
* 2(+
*
*
*
3#!
1
(
*
*
(+
"
C.
C.!
0
;
+
4
9
;
*
(
7
(
8
(
'%
* 2
;
9
1
*
(
1
*
1 (
1 (
"
(
+
*
4 *
+
'2 ;
4
"
* 2
1 (
(
"
*
[WebMethod(TransactionOption=TransactionOption.RequiresNew)]
public void PerformSomeOperation(int someParameter) { … }
+
*
1 (
( 9
*
(
1 (
1
2
*
1
(
(
*
*
1 (
7*
"
*
1
1
+
*
*
"
*
8"
8"
"
8
"
7
7
4/(
4
(
*
*
*
KK
1
2
*
*
XML Web Services
C.(
235
*
*
*
*
*
(
*
1 (
" ;
*
1
;
*
2
1
"
1 (
*
(
=
F
"
*
*
1
"
*
*
+
(
(+
*
4
* 1
*
1 (
"
2
1 (
H *4
+
(
+
*
(
2
"
W
*
71 $8H 7
(
/
#
1
*
4
1
*
7 , 8(
8
*
21
+
/$
*
*
*
1
*
*
KK *
(
"
*
4 *
(+
.
*
(+
(
*
3
E1
1
+
*
1
+*
"
*
*
*
!
#/
";
*
+ *
1 (
(
1 (
1
*
(
"
*
"
C=
C=!
4 1
!3
)
# !")
/1 (
*
# !")
";
1
*
*
1 (
+
( *
*
+*
L %
"
"
*
*
*
1
*
1 (
(
+ *
*
(
*
(+
*
2
1
"
XML Web Services
$
236
1
*
$
; ( +1
*
B
*
(
D/
(
(+
1
"
2
*
[WebMethod(CacheDuration=60)]
public GandagasDataSet GetClients()
{
//ADO.NET code
}
*
*
(
N
*
*
*
*
#
( 1
(
1
1
*
*
1
G"
+
1 *
ASP.NET XML Web Services Output Caching
14
Uitvoeringstijd (s)
12
10
8
6
4
2
0
Cache
Geen cache
Figuur 8.3 – ASP.NET XML Web Services Output Caching
+
*
( *
?-
*
1
1
1
";
*
*
+
*
/
1
(
1
"
+
*
(
+
*
+ (
1
( +
*
*
+" ;
1+
*
@
+ *
+
+
"
*
*
*
*
*
'
":
*
(
*
*
G- [
"
*
*
'
XML Web Services
C=(
237
4 1
# !")
(-
,"-
(
(
*
*
+2
# 3")
,"- 7
C
*
*
.".8" # !")
*
/
"
(+
+
*
+
*
*
(
*
'%
/ (
*
";
1+
,"-
J"-/
(
N
/
" 4
'%
*
,---/
(
'%
*
,---
'%
*
*
(
"
2
+*
*
V
(
(
'%
*
1
J"-
,---
>aspnet_regsqlcache –S sql2000 –U usr –P pwd –D gandagas –T Client
;
*
(
*
*
";
* +
*
*
*
# !")
*
( *
1
*
'%
*
$
( ( *
(+
/ ( 8
*
*
,
N$
( 7
(
+
(
*
J"-/
1 ("
5/
1+
1
(
*
"
1 ("
'%
*
,---/
(
* *
" ;
2
1
1
*
<configuration>
<connectionStrings>
<add name="gandagas"
connectionString="server=sql2000;uid=…;pwd=…;database=gandagas" />
</connectionStrings>
<system.web>
<cache>
<sqlCacheDependency enabled="true" pollTime="500">
<databases>
<add name="gandagas" connectionStringName="gandagas" />
</databases>
</sqlCacheDependency>
</cache>
</system.web>
</configuration>
"
XML Web Services
238
N
7*
8
E
1+
/
1
"#
F8
KK 1
N
-"0
(
(+
(
"
(
*
*
(
1
1
(
1
*
7
N
*
"
G
;
*
# !")
*
C"4
2
*
"
*
*
*
B
(
D/
(
[WebMethod]
public GandagasDataSet GetClients()
{
GandagasDataSet ds = Cache["Clients"] as GandagasDataSet;
if (ds == null)
{
//ADO.NET code
ds = …;
Cache.Insert("Clients",
ds,
new SqlCacheDependency("Gandagas", "Clients")
);
}
return ds;
}
;
*
*
+
1+
+
0
# !")
L %
1 (
*
(
1 (
*
+
*
( 1
# !")
1
C"42
*
(
N
*
B,-D2 ( " 0-J "*"
*
*
/
;
*
!"
+
"
*
1
+
A
1
1
"
( +
'
*
*
+
"
*
CB!
"
(+
1
CB
1
(
E
*
F (+
"
*
1
$
+
1
;
!
XML Web Services
239
,-,/
+ 1
";
*
*
*
*
1+
$
*
(
B
D/
*
(
2
*
*
*
1 (
1
*
[SoapDocumentMethod(OneWay=true)]
[WebMethod]
public void SomeLongRunningOperation() { ... }
5
*
* * 1
*
*
+
1
1
*
*
(
1
*
2
3#/
*
1
5
*
*
*
1
*
*
7
+
+
"
/
I +
[WebMethod]
"
*
C-8"
+
*
*
*
1+
*
* 1
+
'7
"
(
*
5
'/1
1 (
(+
*
"
*
(
(
+
( *
(+
1
(
*
$
+
2
1 (
1
*
*
*
+
*
1
+
*
(
5
/
4
*
(
"
*
*
+ * 1
*
( +"
"
*
2 (+
*
/
1
$
*
+
!
*
*
# !")
1
+
5
1 (
*
1
*
3
*
$
1
2
$
, *
2
*
"
1K *
*
5
1
CB(
+" ;
/ (
(
*
C-"G"J*
I
4 *
*
1
"
1 (
*
8
"
XML Web Services
240
public bool SubmitOrder(Order order)
{
MessageQueue sendQueue = new MessageQueue(…);
MessageQueue ackQueue = new MessageQueue(…);
Message msg = new Message(order);
msg.AdministrationQueue = ackQueue;
msg.AcknowledgementType = AcknowledgementTypes.PositiveArrival;
sendQueue.Send(msg, order.ID);
TimeSpan timeout = TimeSpan.FromSeconds(30);
Message ack = ackQueue.ReceiveByCorrelationId(msg.Id, timeout);
return ack != null;
}
*
$
(
/5
1 (
1
1
1
"3
+(
(
*
1
1
"
"
788
1
1
"
1
7
&
7
*
*
*
*
*
* 1
1
*
8
(
1
+(
/
1 (
*
1
*
8
(
*
1
7
(
+
1
*
*
* 1
7( +
*
"
(
+
2
*
'
*
*
5
5
*
'
&
(
1 (
*
1
'
2 1
*
" #
+
(
/ (+
&'8
+
"
+
1
*
"
*
*
*
+1
( *
3#!
"
"
1+
2
*
"
(
KK
1
*
+
"
2
((
* 1
*
G-
1
(
3
") 1
(+ *
'
1
1
1 (
#
*
"
(
*
"
*
*
1 (
"
CC
1
*
*
*
5 "
*
*
"
5
/
! *
*
7
J8
1
"
XML Web Services
241
*
*
1
*
*
/
*
1
"H
*
public void UpdateProducts(ProductsDataSet changes) { ... }
1+
<
public void UpdateProduct(int ID, string name, double price, ...) { … }
//of
public void UpdateProduct(Product product) { … }
*
2
7
KK
KK
1
0"08
* 1
*
"
*
1
( *
o
1 (
+ '%L %
'%
1 (
*
*
,--0
/
+ 1
1+
8M
*
+"
1
(+
*
*
Y7
8
o
+
o
*
4
M
* *
*
; *
E(
F
*
*
1
/
2
"
1
1
/
*
1 (
3 1
*
*
Y
*
o
*
*
*
*
1+
*
7
*
*
+
1
( +1 (
(
*
7
*
Y
((
(
*
F +
+
(+
+
")
&
(+
K
*
+
1
*
1
(
2
(+
*
1
*
*
P
1
9
P8"
(
";
*
*
E
+
"
1
KK
(
*
*
"
(
1
+
"
*
1
"
XML Web Services
CE
242
7
CE!
*
*
(
((
1
/
1 (
"
CE(
*
(
/
1 (
*
F
*
+ *
/
"
E
(
*
/
*
(
1 (
/
*
(
7
1
8
/
/
(
"
$
*
(
1
+ (
*
"
*
1
$
(
*
*
1
,"- 7
2
(
1
9
1/
(+
*
$
*
2 5 /
2
2
(
2
"8
%
4/
(
2
*
*
*
*
(
"8" 3
/
+ 2
+
1
(+
(
*
1
*
7( +
*
(
(
1
F
8 *
4
*
*
%/
"
/
(
7
E
7
8(
2
1
((
*
/
1
*
*
+
7 5
*
+ "
#
7
*
*
4/
* +
/ ( 8"
(+
."CC8"
$
1
+
*
(
")
(
+8
*
*
5
(
+7
7
";
/
9
*
(
1
"%
1
*
*
(
*
(
4
8"
+
1
(
2
(
(
+
7 " C","G8"
1
7
+
1
+
2
XML Web Services
243
2
2
1
"8"
(
CE/
*
1
7
/8
1
/
"
3
(
*
() #
"
# !")
*
1
4
1
+
+
*
1
!
*
/
(+
*
(
(+
*
1
"
+
(
1
(
2 1
(
*
5
4
*
1
1
1
(
*
KK
*
*
(
*
4
*
/ 4
+
(
/5
/
2
4
4
"
+
*
*
(
/
/
1+
(
(
(
3
"
1 (
(
"
"#
/
+*
*
() #
( * "
*
4
*
+
3
+ 4
*
*
*
2
*
/5
5
* "
//service
[WebMethod(TransactionOption=TransactionOption.RequiresNew)]
public void InsertProduct(Product product, Supplier supplier)
{
…
throw new BusinessException("Contract met leverancier is verlopen.");
}
//client
{
Product p = …;
Supplier s = …;
SomeService proxy = …;
try {
proxy.InsertProduct(p, s);
}
catch (SoapException ex) {
BusinessException bex = ex.InnerException as BusinessException;
…
}
}
XML Web Services
;
244
*
(
4(
*
/
*
+
*KK
*
*
1
(
(
/
1
(
*
1
(
(
*
+
7
*
1
C"
4
(
F
1+
+ 1
";
*
$
KK *
*
(
/
*
*
1+
KK
+
1
*
*
*
*
(
"
21
* 1
1
*
1
+1K
."
*
1+
+
"
(
&1
X:
*
1 (
*
*
9
*
*
"
+
*
1 (
"
*
1
1
*
*
*
"
2
1
+
"; 1 1
"3
*
"
"
(
21
/
*
+
1
*
+
(
+
1+
*
"
*
*
G"
*
+
+
1+
(
"
"
+
,"
1 5 1
4
+
4
(
2 *
"
9
*
)
*
*
E
1 (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GandagasServer
{
ArrayList GetClients();
Client GetClient(int id);
Client CreateClient();
void SaveClient(Client client);
}
*
1
*
+ 1
(+
1
")
(
1
"3
*
* "
( +1 1
1 *
/
* / (+
&
%
*
"
*
public class GandagasServer : MarshalByRefObject, IGandagasServer
{
public override object InitializeLifetimeService()
{
return null;
}
//implementatie interface
}
"
+
.NET Remoting
251
+
*
(
* +*
*
*
+" ;
*
*
(
(
"
" ;
*
( D
1
1+ "
(
";
(
*
*
+ (+ 1
G"J"0"
5
*
2
"
1
/
((
1
*
*
*
1
")
+
2
&
(
"
1
"
*
*
/
(
1
1
(
/
1
*
1
1
1+ (
" ;
2
*
$3 > *
H
*
* +
1
"
1
*
1
(
"
/
+
1+
#
(
/
1
*
<
(
$
*
( *
*
*
)
*
/ (+ * B
2
1
2
(
*
( *
5
* /
4(
(
*
"
*
";
"
*
21
(+
;
7
!
8"
*
1
*
* +
1
C"
1E
,"
3
G"
E
4
*
F/
3
*
F/
*
*
*
*
5
0" $
+ "
/
"
*
."
/
"
/
*
)
";
*
1
*
*
1
"
+ "
)
1
: " 4
E
1
2
")
* F1
1
1
*
*
6" #
*
*
*
*
1
.NET Remoting
252
>net start GandagasServer
;
*
1
*
*
*
/
public class Service1 : System.ServiceProcess.ServiceBase
{
…
protected override void OnStart(string[] args)
{
ChannelServices.RegisterChannel(new HttpChannel(4545));
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(GandagasServer),
"GandagasServer",
WellKnownObjectMode.Singleton);
}
}
*
(
+
*
2
L %/
;
(
!/
.0.0" #
( 1
"
* 1
public class GandagasServer : System.ServiceProcess.ServiceBase
{
…
protected override void OnStart(string[] args)
{
RemotingConfiguration.Configure("GandagasServer.exe.config");
}
}
1
(+
* " 4 "
/(
*
*
<configuration>
<system.runtime.remoting>
<application name="GandagasServer">
<service>
<wellknown mode="Singleton"
type="GandagasServer, GandagasServerLib"
objectUri="GandagasServer" />
</service>
<channels>
<channel ref="http" port="4545" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
.NET Remoting
;
253
*
5
(+
( 5"
* 1+
*
*
(
* /
1
(5
* % (" "
( *
5
"&
E/(
5
"&
"$
";
"&
"&
"
&
*
/
*
1
+ 1
*
1
P"G"G8
1 + ( +1 (
1
*
";
1
(
*
"
*
(
1
*
*
2
%7
"
*
(+
* "# *
(
/
public class Client
{
public static void Main (string[] args)
{
RemotingConfiguration.Configure("Client.exe.config");
IGandagasServer srv = (IGandagasServer) new GandagasServer();
…
}
}
(
<configuration>
<system.runtime.remoting>
<application name="Client">
<client>
<wellknown type="GandagasServer, GandagasServerLib"
url="http://server:4545/GandagasServer"/>
</client>
<channels>
<channel ref="http" port="0" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
.NET Remoting
*
254
2
2
*
*
*
";
*
* / (+
1
+
1
*
( 1
E//
"
*
(
( *
* /
(
5
/ + *
*
"
1
1
4(
(+
(
*
(
"
2
# *
/
2
*
*
1
9
5
+
*
"3
"&
(
"&
*
IGandagasServer srv = (IGandagasServer) Activator.GetObject(
typeof(IGandasgasServer),
"http://server:4545/GandagasServer"
);
+
"
(
:&
(
_
* *
1
*
";
*
7
(
*
5/
*
1
*
(
"#
* (
1
^
*
(
*
*
*
")
&
*
"
5
(
( *
")
1
*
%
*
6
1
(
*
" ")
45*
1
(+
";
3 1
$O/
(
%/
&
*
(
soapsuds.exe -url:http://server:4545/GandagasServer?WSDL -gc
"
*
8
.NET Remoting
255
*
*
*
1
1
(
45
*
;
E8
* /
!/
"
"
%
*
*
((
1
@
(
*
*
1
"
(+ 7( 1
* "
(
8
$
"
$
2
+
1
*
5 21
(+
"
(
+ (
<
"
1
/ (+
(+
2
*
* "
(+
(+
2
*
KK
1
((
(( 2
7
*
*
1+
8"
5
*
1
*
<configuration>
<system.runtime.remoting>
<application name="GandagasServer">
<service>
<activated type="GandagasProduct, GandagasServerLib"
/>
</service>
<channels>
<channel ref="tcp" port="5454" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
1
*
(
1+
*
1 1
*
$!/ (
*
";
*
*
(
1
1
0.0." #
*
7
(
2
(
*
2
( 58
"
1
*
^
*
_/
!
/
.NET Remoting
256
<configuration>
<system.runtime.remoting>
<application name="Client">
<client>
<activated type="GandagasProduct, GandagasServerLib"
url="tcp://server:5454/GandagasServer"/>
</client>
<channels>
<channel ref="tcp client" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
;
(
5
!
1
*
(
2
public class GandagasProduct : MarshalByRefObject
{
private int? _id = null;
private string _description;
private double _unitPrice;
public static GandagasProduct GetProductById(int id)
{ … }
public GandagasProduct(string description, double unitPrice)
{ … }
public int? ID
{
get { return _id; }
}
public string Description
{
get { return _description; }
set { _description = value; }
}
public double UnitPrice
{
get { return _unitPrice; }
set { _unitPrice = value; }
}
public void Save()
{ … }
}
*
*
*
*
(
";
1
*
(
"3
#
/
2
(
5
/
"
.NET Remoting
257
!
*
5
N$
* ( 1
/ *
"
1
(
1
(
*
1
7( +
/
(
*
*
1
*
*
"
*
8
(
*
V
)
"
& /
$O ,"-/
1
*
* /
*
"
1
4
* 1
(
/
V
*
*
/
:! #
*
$O C"-
(
*
(
/*
*
*
(+
(+
V "
(
(+ "
1
public int CreateProduct(string description, double unitPrice)
{
GandagasProduct product
= new GandagasProduct(description, unitPrice);
product.Save();
return product.ID;
}
(+
(
"
1 (+ 1
*
(
* "
1 (+
1
"#
*
(+
*
KK
*
2
2
*
(
* "
*
public void ChangeProduct(int id, string description, double unitPrice)
{
GandagasProduct product
= GandagasProduct.GetProductById(id);
id.Description = description;
id.UnitPrice = unitPrice;
product.Save();
}
5
+
1 1
(
* "
1
(+
+
*
2
"
>?
2
(
*
(
*
/
( *
"
*
+
1
.NET Remoting
258
(
1
2
+
*
(+
*
(
*
1
*
E.
1
(
(+
1
2
"
")
&
"
9
( " CGP *
*
/
*
:"$ H
B,CD
"
1
1
(+
(
L
1 *
Services are the preferred communication across application boundaries, including platform, deployment, and
trust boundaries. … If you use .NET remoting, it should be for cross-application domain communication within a
single process and not for cross-process or cross-server communication. The other situation where you might
use .NET remoting is if you need to support custom wire protocols. However, understand that this customization
will not port cleanly to future Microsoft implementations.
( *
*
*
(
*
")
&
*
1 (
\
(
*
* *
1
*
/]
*
/
2
")
*
(
$!" ;
";
")
(
*
*
*
*
1 (
9
(+
*
(
":
/
*
*
/ (+
1
\
*
*
")
1
* 1
(
*
+2
+
2
*
(
+ +"
1
*
*
"
")
" 3(+ /
T!
1*
( +
1
!
*
)
(
(
/
3#!
&
*
*
*
(
(
&
(
+1
1
( 1
1
&
(
9
(
1
"
+
B,CD 7( " .QC8
*
*
*
/
*
When you design distributed applications, use the services approach whenever possible. Although object
orientation provides a pure view of what a system should look like and is effective for producing logical models,
.NET Remoting
259
an object-based approach can fail to consider real-world factors, such as physical distribution, trust boundaries,
and network communication, as well as nonfunctional requirements, such as performance and security.
*
((
(
*
(
(
(
1
/
5
2
2
1
*
&
1
+
"
*
*
(+
*
&!$/
1
2
1+
1
$
*
1
(
*
1 (
")
1
*
(
*
*
(+
*
="
*
*
1
# 7
8" ")
&
+
* +
*
(
+
+
+
(
(
")
7
*
&
(+
*
*
* 1
*
+
/
1
3#!/ (
*
/
(+
9
")
( +
*
*
KK
# !")
(
+
+
*
(+
(
*
(
*
(
M
"
*
2
;
L %
+"
+*
N
*
".",8 (
# !")
@
1
(
( *
(
E=
*
"
((
*
L %
7
*
&
1
+1 (
1 "
1
(
&!$/
$ / (+
(
*
(+
*
* # !")
+
(
(
21
1
"3
"
$3 8
*
(
*
(
/
*
2
*
!
(
.NET Remoting
260
(
I
(+
*
(+ /
9
I
+ "
(
2
"
(
+
(
*
(
*
*
*
* 2 1
( +*
*
";
@
( <*
(
*
1 (
1 (
*
"
*
(
/5 21
*
(
2
"
*
+
B0D2 ( " CC
The bottom line is that good remote application design can frequently seem like poor object-oriented design. You
can’t simply apply every local object metaphor to distributed object scenarios without considering performance.
(
(+ /
*
1 (
9
* 1
1
";
+
(
*
1 (
*
1
N
*
(
E
(+
*
(
F
2
*
";
7
8"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*
7
(
*
(+
"""F2
$3 /
MSMQ
264
Figuur 10.3 – Aanmaak van een trigger
!-/
%
!-/ !
;
'
(
(
*
"
'
*
+
(
+
8
1
!-/ (
1
1
(
*
'
2
7*
*
5
'
"
"
1
+
82
7
L
"
@
+
1
*
"
*
[ComputerNaam]\Private$\[Wachtrij]"
[DomeinNaam]\[Wachtrij]
[ComputerNaam]\[Wachtrij]
4(
*
1
,
"
(
(
"#
*
5
1
+
"#
1
(
2 1
(+
(
1
+
+
+ 1
+ *
(
1
1
1
*
*
:
MSMQ
265
7
( 5: N
;
!7
8*
1
"G"G"?8" 3
!-/ /
(
7
&
1
+
1
*
+
"
'
" ; (+
* "3
*
":
(
$
1 1
(
*
* 1+
1
*
"
(
1
(+
1
*
(
+
$
"
1
+71
*
1
+
+
1
0
*
3
*
8*
";
1+ *
"
#
((
+
*
1
*
1
*
(
@
(
;
+
*
+ *
! ( '
5
+
1
( *
(
(
2
! ( '
(
+ *
(
1
*
*
52
*
1
*
*
2
5% ( 2
"
1
*
7( +
*
$
/1
+
3
(
*
/
*
1
+
"
1
")
/
2
*
C-"." ; ( +
*
+
*
8"
1
<
*
1
1
7
*
(
MessageQueue GetQueue(string path)
{
if (!MessageQueue.Exists(path))
return MessageQueue.Create(path);
else
return new MessageQueue(path);
}
(
*
! ( '
+
1
'
*
+
+"
*
8
*
! ( '
*
*
*
'/
(
5$
*
+
/
+"
*
*
+
+
MSMQ
266
Figuur 10.4 - Message Queues via Server Explorer
!-/ 8
)
(
5 "
*
(
*
*
*
(
*
*
5
47
(
8
*
MessageQueue queue = …;
queue.Send(obj, label);
( *
(+*
*
(
5
21
*
+
"
(
*
(
(
1
(
*
+*
*
(
1
+
"
/
*
5
#
1
"
"
*
)
(
"
*
"#
"
+ 5
(
1
(
+
"
5
5
"
*
*
5
(
*
' "
4
*
5
+
1
+
*
( *
*
"
1
(+
+2 1
5
MSMQ
267
*
(
*
+ 5
1
*
[Serializable]
public class Order
{
public Order() {}
public int quantity;
public int productId;
public string remarks;
}
;
*
*
1
* 2 *
*
(
(+
*
/
5
"
1
1
(
*
+
*
4
((
*
*
*
(
2
"
string SendOrder(MessageQueue queue, Order order)
{
Message msg = new Message(order);
//instellen van eigenschappen op het object msg
//voorbeelden: UseEncryption, Priority, TimeToBeReceived, etc.
queue.Send(msg, order.ID.ToString());
return msg.Id;
}
( *
1
(
*
1
N
*
*
(
*
*
*
*
*
(
*
2
*
"
( *
*
1 *
(
"
!-/ .
)
(
*
(
1
+
*
(
*
2
* 1
(
1
+
MessageQueue queue = …;
Message msg = queue.Receive();
"
1
1+ (
* /
5
+
+
*
*
* 1
9
";
MSMQ
268
*
1
" H
1
1
+ *
*
,
/
5*
1
)
57
N
7L %
*
+
1
58
*
1
5
5
*
"
1
" ; ( +1
(
'*
(
*
*
*
*
1
(
(
* "
(
/ (+ " $
1
5
*
(+
*
+
MessageQueue queue = …;
queue.Formatter = new XmlMessageFormatter(new Type[] { typeof(Order) });
Message msg = queue.Receive();
Order o = (Order) Msg.Body;
+
1
* /
(
"
* 1
(
*
(
* 1
public class Server
{
private MessageQueue queue;
public Server(string path)
{
queue = new MessageQueue(path);
queue.Formatter = new XmlMessageFormatter(
new Type[] { typeof(Order) });
}
public void Start()
{
while (true)
{
Message msg = queue.Receive();
Order order = (Order) msg.Body;
WorkerThread worker = new WorkerThread(order);
new Thread(new ThreadStart(worker.Do)).Start();
}
}
class WorkerThread
{
private Order order;
public WorkerThread(Order order)
{
this.order = order;
}
public void Do()
{
//verwerking order
( +
*
+*
2
MSMQ
269
}
}
}
:
( *
*
*
(
2
"
/
+
(
*
(
9
1
(+
*
2
1
1
2
1
+*
*
&
*
(+
* 2
*
1
(
+
"
'
(
1
*
"
1
1
*
5
*
*
"
9
(
(
(
*
*
7
*
* /
* 1
(
1
1
*
+
foreach(Message msg in queue)
//bekijk bericht
!-/ =
*
1
2
(
*
*
1
(
3#" 3
(
(
1
(
1(
(
*
'
*
2 *
G"J"08
(
(
( +1 (
+
*
*
*
7
(
1
*
(
(
(
(
1
*
+ *
?
*
*
'
(
1
'
*
5
" :
*
SS '
1
@"
+
*
(
";
*
* 1
*
(+ * 1
6
*
*
*
*
" "#
(
*
*
(
*
(
5
(
5 /
*
* /
5
(
+ +
(
"
Naar aanleiding van een consultancy-opdracht voor het bedrijf Xistenz (www.xistenz.be) uit Schoten.
MSMQ
270
#
)
L %/
*
(
*
1K
+"
1
(
(
1+
1
+( *
<
21
(
"
Figuur 10.5 – XML-serializatie van berichten
1
(+
1
(
*
+
'
( *
2
(
(
2
(
*
"
(
1
/1
+(
1
*
"3
/
(
")
*
&
(
1+
KK
1
1
1
(
1
*
*
1
1
2
*
"
4
"
public void Start()
{
TimeSpan timeout = TimeSpan.FromSeconds(5.0);
while (!stop)
{
try
{
Message msg = queue.Receive(timeout);
if (msg == null)
continue;
1
MSMQ
271
Order order = (Order) msg.Body;
WorkerThread worker = new WorkerThread(order);
new Thread(new ThreadStart(worker.Do)).Start();
}
catch {}
}
}
;
(
*
*
*
(
2*
(
1
5
";
*
*
(
(
*
(
1
*
1
(+
$3 /
(
4
+
/
/
1
*
(
Figuur 10.6 – Parameterisatie van de regels
+
5
(
*
(
"
*
7
1
&
2
*
1
*
!
2
2 *
(
(+
(
"
* " 4 "
C-",8
9
#
$3
*
7
A
8
1
*
*
*
*
7 " 5
1
*
*
8
4
"
( *
( 1
(+
*
"
MSMQ
272
/
*
1
7 "
BD
(
(
*
1
(
+*
(
2
"
(
7*
*
*
2
*
*
21
*
+
8
"
8
" ;
1
(
(
*
(+
"
(
1
+( +
*
*;
7
1 *
*
1
*
2
(
"
*
1
21
&'82
*
* *
* *
(
*
*
*
7
;
+
+ (
&82
(
(
(
"
1
*
*
(
( *
1
+
(
*
*
# *
@
5" ;
+
+
*
"
2
*
+
+
+
(
1
7
7
*
*
8
(
(
3
1
+
(
*
1
*
*
+1
9
C-"?
4
*
(
(
#
+
1+ 1
+
5 *
"
52 A
(
(
*
"
*
"3
*
(+
&
1
2
+
1
* "
(
*
*
* 1
*
(
*
*
*
8"
2
7
*
8
( *
2
"
(
(
*
21
(
(+
*
*
*
(
(
/
*
1
+ 2
"
MSMQ
273
!-/ B
(
5
1
*
(+
(
1
" ;
2 1
( +(
1
*
*
;
(
*
*
1
*
(
+
*
1
*
((
(
(
2
";
5
2 (+
*
*
1
(
+ (
+
+
(
+
"
*
+
( *
*
( *
(
1
1
*
*
* (
&
(
*
"$
( *
*
"
'1
/ (+ "
*
(
$
"
1
*
(
*
*
*
1(
*
2
1
(+
*
*
MessageQueue sendQueue = …;
MessageQueue ackQueue = …;
Message msg = new Message(obj);
msg.AdministrationQueue = ackQueue; //wachtrij voor ontvangstbevestigingen
msg.AcknowledgementType = AcknowledgementTypes.PositiveArrival;
sendQueue.Send(msg, label);
Message ack = ackQueue.ReceiveByCorrelationId(msg.Id);
if (ack.Acknowledgement == Acknowledgement.ReachQueue)
{
//correcte ontvangst
}
*
1
*
(
+
"
(
*
(
1
(
1
(
( *
+
5
4
*
( *
(
5
*
1
1
* 1+
(+
1
7
1
'
8 5
")
"
*
*
(
9
"
1
*
6/
+
MSMQ
274
!-/ C
6
7
1
(
1
+
1
+1
7
*
*
*
21
*
*
/
8
1
(
*
(+
(
1
";
1
(
*
(
1
"
(+
*
*
1
MessageQueue requestQueue = …;
MessageQueue responseQueue = …;
Message msg = new Message(obj);
msg.ResponseQueue = responseQueue; //wachtrij voor antwoorden
requestQueue.Send(msg, label);
Message response = ackQueue.ReceiveByCorrelationId(msg.Id);
* /
(
*
&
'
1
MessageQueue requestQueue = …;
MessageQueue responseQueue = …;
Message request = requestQueue.Receive();
//verwerking op basis van request.Body leidt tot antwoordbericht response
Message response = …;
//correlatie van het antwoordbericht met het originele bericht
response.CorrelationId = request.Id;
//verzending naar antwoordwachtrij
request.ResponseQueue.Send(response);
!-/ E
%
" "#
'1
*
/
;
*
(
*
(
*
E
F
(
1(
(
'
(
7
*
#"
/
21
$3 > *
*
*
+ +
<
8
(
"
*
(
1
(+
*
*
MSMQ
275
1
*
1
1
1 (
";
1
+
*
*
" ;
(
' *
(+
*
8"
1
1
'*
(
(
1(
*
!-8
(
*
I
7
*
!
$
5
"
1
(
*
+
1
*
/
*
F
+
*
*
((
%
'*
7
&
+E
*
1
(
KK
*
*
*
N
/
2
$
(
")
*
*
7%!$= 8" 3
*
(
(
*
(
(
")
'
I
(
5 0
1
8
"
&
(
"
+
" "#
!-8 !
1
'
1
1
( 1
(
(
1 (
*
5
+
1
*
*
1
* 1
+
*
/
9
"
K *
(
"H
1 (
*
1
1 (
*
/ \
/
3#!/
1 (
2 1
*
*
/
*
'/ (
(
(
"
F/
(
(
*
2
(
E
*
*
1
(
P
45
* (
*
3'
+ *
+
/
"
N *
*
"
'2
*
1
*
C-"J"
1 (
*
MSMQ
276
Figuur 10.7 – Web services communicatiemodel
C-"Q *
1
1
N *
'/
*
((
1
*
*
" ; ( +1
*
1
(
1
*
9
"
Figuur 10.8 – MSMQ-services communicatiemodel
!-8 (
0
>" "#*
I*
1 1
*
*
1
(
(
?
*
*
+
*
I(
*
/
7
1
8
'/
"
*
[MsmqService]
public class SomeService
{
[MsmqMethod]
public int Sum(int a, int b)
{
return a + b;
}
}
(+
*
(
N *
*
(
N
*
(
1
1 (
*
1
(+ (
"
(
1
*
*
(
(
"
MSMQ
277
*
*
(
*
*
*
*
*
8"
*
(
4
*
*
/
&!$ 7
1
(
9
*
(
1
1 *
"
*
*
*
2
*
*
1
+1
"
1
;
N *
*
1
*
*
*
/
" 3
*
2
*
*
(
(
(
"
(
21
7
*
2
'
2
"
2
* (
F
1
*
*
(
1
1
*
( +1 (
*
";
+
+
2
F2
'
E
*
1 (
E
K *
'
!/(
'/(
*
*
( 5"
8
"
(
(
(
(+
*
*
(
[Serializable]
public class InputSum
{
public System.Int32 in1;
public System.Int32 in2;
}
(+
)
/
(
1
(
(
1
;
*
*
/
1
+ E
5 F7
(
+
+
*
" )
*
*
"
(
1
1
* 8
5 21
*
2 1
'
"
*
%
5
/
(
( *
(
*
1
21 1 *
*
'"
*
*
;
(
*
+ (
4
1 (
(+
"
1
1
*
(
5
1
"#0$ 7
'
MSMQ
278
%
'/
*
8 *
";
2
L %/ (
' %/
*
*
*
*
(
(
+
*
1
*
*
<?xml version="1.0" standalone="yes"?>
<MqdlDocument>
<Service svc="SomeService" component="SomeTestService.SomeService">
<Operation id="Sum">
<Input>
<Parameter name="a" type="System.Int32" />
<Parameter name="b" type="System.Int32" />
</Input>
<Output type="System.Int32" />
</Operation>
</Service>
</MqdlDocument>
+
1 *
' %/
1
(
";
*
*
*
*
#
*
N " 4
(
*
%/
*
;
!/
%
*
*
7*
*
*
*
' %/
*
"
(
+
4Y
*
%8"
*
3'
*
'/
";
1
1
1
+ +
+
*
*
using System;
using SomeServiceService.Proxy;
class Consumer
{
public static void Main(string[] args)
{
SomeService svc = new SomeService(".\\private$\\");
int sum = svc.Add(2,3);
Console.WriteLine(sum);
}
}
;
1
*
*
(
*
N
KK 1
+
*
1
"
KK 1
+*
1
+
(
/
";
+
*
*
5
(
( *
1
(
2
"
*
E
F
MSMQ
279
!-8 /
H
" "#*
*
1
(
*
(
/
1
1 (+
*
(
*
1
*
1
'
"
Figuur 10.9 – Structuur MSMQ-service ontwikkeling
$
+2 1
1
*
1
1
'$
* "&
2
' %/
(
*
*
+
" "#
(
,"
(
* "
1
C" 3 1
+
*
" ;
4
N *
N
"#0$*
*
*
'
G"
*
1
(+ (
*
"
N " 4 A 4
*
#
"
2
/
*
/
( * "
1
(
(
*
' %/
*
1
L %"
*
" ;
N " 4 A*
1
1
$O/
(+
MSMQ
280
."
+
4
/
(+
*
*
(
0"
(
1
5
(
/
*
+
&
N " 4 A
Q"
5
4
*
(
1
"
2
1
(+
3
( 1*
2
C-"P2 (
N " 4 "
1
+"
3
*
E
N " 4 /
1 "
F" H
(
"
(
+
+
/
*
*
*
*
! 45
&
1 *
(
*
4
;
(
"
"
!-8 8
!-8 8 !
(
' %/
"
+
*
* *
(+*
(
&
'/1
*
+"
45 1
$O/
*
/
"
* "
J"
+
4
1 3'
1
*
"
*
*
?"
*
(
(
1
;
"
*
;"
(
+
1
+"
*
*
N " 4 /
(
*
namespace MsmqTools
{
[AttributeUsage(AttributeTargets.Method)]
public class MsmqMethodAttribute : Attribute {}
[AttributeUsage(AttributeTargets.Class)]
public class MsmqServiceAttribute : Attribute {}
}
9
1
*
*
(
(
*
*
1
*
1
using System;
;
*
/
1
(5
(
' %/
(
1
")
1
"
*
MSMQ
281
(
1
((
7(
N " 4 8 *
*
*
1
4
/
*
N " 4
'/
*
";
(
*
>mqdl.exe /export “ServiceNamespace.ServiceClass, ServiceAssembly”
Service.mqdl
;
(5
5
*
*
#
$
' %/
(
*
5
";
( 5"
7
)
*
" N " !
*
+
(
1
1
*
*
*
*
(
"
L
,--0
/
1
#
(5
"
*
(
*
5 2
1
(
7
N " 4
N " 4
1 *
" ;
(+
(
")
'
3
1
" 4 8
*
1
")
' %/
+
1
21
1 *
L %/
1 L %/
C-"C-8"
Figuur 10.10 – XSD schema inferentie in Visual Studio 2005
;
(
L
5 5
1
*
/(
1 * *
" ;
(
1
*
*
*
L %
N
' %/(
+ "
")
,--G
(
2
(+
MSMQ
282
*
(
*
1
*
2
' %/
( +
(
*
*
*
5 (
/ 4
//
//Create MQDL document (t:System.Type contains the loaded type)
//
MqdlDocument doc = new MqdlDocument();
MqdlDocument.ServiceRow svcrow
= doc.Service.AddServiceRow(t.Name, t.FullName);
//
//Find operations tagged with MsmqMethod attribute
//
string mma = new MsmqMethodAttribute().ToString();
foreach(MethodInfo m in t.GetMethods())
{
foreach(Attribute a in Attribute.GetCustomAttributes(m))
{
if (mma == a.ToString())
{
MqdlDocument.OperationRow oprow
= doc.Operation.AddOperationRow(m.Name, svcrow);
MqdlDocument.InputRow inputrow
= doc.Input.AddInputRow(oprow);
foreach(ParameterInfo p in m.GetParameters())
{
doc.Parameter.AddParameterRow(p.Name,
p.ParameterType.FullName, inputrow);
}
doc.Output.AddOutputRow(m.ReturnType.FullName, oprow);
}
}
}
L
*
N
7 *
' %/
1
9
*
*
8
(
"
!-8 8 (
*
*
( 1
*
$O/
#
+
*
*
1
(
*
(
*
#
(
*
*
(
*
'
* +
+
!
3 *
*
1
1
4" :
M
+ *
*
M
+
*
%!$=
M
*
*
+
9
* 1
"
+
*
1
MSMQ
$
283
1
*
*
1
";
/
1
*
*
1
1
1
+
*
(
public class SumMonitor
{
delegate System.Int32 ProcessDelegate(System.Int32 in1,
System.Int32 in2);
private class ProcessCallbackData
{
public ProcessDelegate pdel;
public Message msg;
}
private MessageQueue queue;
private bool stop = false;
private bool stopped = false;
public SumMonitor(string prefix)
{
string path = prefix + "SumRequests";
if (!MessageQueue.Exists(path))
MessageQueue.Create(path);
queue = new MessageQueue(path);
queue.Formatter = new XmlMessageFormatter
(new Type [] { typeof(InputSum) });
}
public void Stop()
{
stop = true;
while(!stopped);
}
public void Start()
{
while(!stop)
{
try
{
Message msg = queue.Receive(TimeSpan.FromSeconds(5));
InputSum input = (InputSum) msg.Body;
SomeTestService.SomeService svc
= new SomeTestService.SomeService();
ProcessDelegate d = new ProcessDelegate(svc.Sum);
ProcessCallbackData pcd = new ProcessCallbackData();
pcd.pdel = d;
pcd.msg = msg;
d.BeginInvoke(input.in1, input.in2,
new AsyncCallback(Done), pcd);
}
catch {}
}
MSMQ
284
stopped = true;
}
private void Done(IAsyncResult res)
{
ProcessCallbackData pcd = (ProcessCallbackData) res.AsyncState;
OutputSum output = new OutputSum();
output.output = pcd.pdel.EndInvoke(res);
Message resp = new Message(output);
resp.CorrelationId = pcd.msg.Id;
pcd.msg.ResponseQueue.Send(resp);
}
}
1
(
"
5
5
1
*
1
*
" ;
*
*
(
+*
5
(
1
(+
* 1
/
"
1
&
1
0
/
(
*
(
(
*
1
"
*
/
*
(
public class ServiceManager
{
private SumMonitor m1;
public ServiceManager(string path)
{
m1 = new SumMonitor(path);
}
public void Start()
{
new Thread(new ThreadStart(m1.Start)).Start();
}
public void Stop()
{
m1.Stop();
}
}
;
1
* /
*
"
*
(+
*
/
*
+
*
*
(
1
*
MSMQ
285
public static void Main()
{
ServiceManager mgr = new ServiceManager(".\\private$\\");
mgr.Start();
}
1
3
*
"
(
'
1
*
*
(
*
' %/
[Serializable]
public class InputSum
{
public System.Int32 in1;
public System.Int32 in2;
}
[Serializable]
public class OutputSum
{
public System.Int32 output;
}
+
*
*
(
*
1 1
"
+ (
(
*
+
*
+ (
*
*
1
*
' %/
(
*
*
(
J82
+
"3
(
*
*
1+
*
L % /(
1
";
1 1
*
"; 1
: $ /(
( 1
*
7 "
*
1
1
(
(
*
L % /(
+ (
L %/ (
1
*
"
N " 4 /
(5*
*
static string GetResourceString(string name)
{
string ns = Assembly.GetExecutingAssembly()
.GetName().Name.ToString();
Stream s = Assembly.GetExecutingAssembly()
.GetManifestResourceStream(ns + "." + name);
MSMQ
286
if (s == null)
return "";
byte[] buf = new byte[s.Length];
s.Read(buf, 0, (int) s.Length);
return Encoding.Default.GetString(buf);
}
static XslTransform GetTransform(string name)
{
XslTransform xslt = new XslTransform();
MemoryStream ms = new MemoryStream();
XmlTextWriter xtw = new XmlTextWriter(ms, null);
XPathDocument doc
= new XPathDocument(
new XmlTextReader(GetResourceString(name + ".xslt"),
XmlNodeType.Document, null));
xslt.Load(doc.CreateNavigator(), null, null);
return xslt;
}
;
*
*
:
L % /
/
+
")
1
*
*
"
Figuur 10.11 – XSLT-ontwikkeling in Visual Studio 2005
(
1
*
L % /(
*
L % /
1
*
1
*
1
*
(
,--0 1
(
'/
*
*
*
L % =
1
*
1
(+
(
+ "
(+
"
+
MSMQ
287
C-"CC
*
(
1
E
(
F*
1
*
(+
*
L % /
"
*
1
5 4*
*
*
N " 4
*
45
>mqdl.exe /svcman Service.mqdl svcman.cs
!-8 8 /
1 3'
*
*
*
N " 4 /
(
'" ; ( +1
I *
1
1
1+
*
(
(
(
1
*
/
*
*
*
(
*
45"
1
L %
*
(
45
*
94
I
' %/
" #
L % /
(
1
*
*
*
public System.Int32 Sum(System.Int32 a, System.Int32 b)
{
MessageQueue __queueReq = new MessageQueue(__path + "SumRequests");
__queueReq.Formatter = new XmlMessageFormatter(
new Type [] { typeof(InputSum) });
string __pathResp = ".\\private$\\" + Guid.NewGuid().ToString();
MessageQueue __queueResp = MessageQueue.Create(__pathResp);
__queueResp.Formatter = new XmlMessageFormatter(
new Type [] { typeof(OutputSum) });
InputSum __input = new InputSum();
__input.in1 = a;
__input.in2 = b;
Message __req = new Message(__input);
__req.ResponseQueue = __queueResp;
__queueReq.Send(__req);
OutputSum __output = new OutputSum();
try
{
string __id = __req.Id;
Message __msg = __queueResp.ReceiveByCorrelationId(__id,
TimeSpan.FromSeconds(__timeout));
__output = (OutputSum) __msg.Body;
}
finally
{
MessageQueue.Delete(__pathResp);
}
return __output.output;
}
MSMQ
288
+*
*
*
*
*
*
(
"
*
*
(+
*
(
7 C2
(
*
,2
"
1
+
"8
*
*
*
";
+
*
45 * +
*
@7VVN
&
45
(+
2
(
*
(
+ "
8
1
1
@
*
*
1
;
+
1
1
* 1+
*
45 *
(
1
(
1
*
1
*
(
1
1
*
'
"
@
(
*
2
'/
(
(
(
*
1
+
1
45
(
"
+
*
N
*
*
1
5
*
'
*
*
"H
+
L % /
& N8" 3
"
*
1+
(
+
*
"
+
" )
+ +
81
*
7VVN
1
*
"
(
@
*
+ + 1
7
*
@
1
+
(
"
*
45"
45
*
(
(+
+ +
*
(
+
1
/
!-8 .
*
1
*
(
*
1
*
" #
*
1
(
*
+
"
*
'/
*
* 1
+
1
2
N " 4 "
(
2
"
4
MSMQ
289
!-8 =
%
(
1
1
(
*
*
*
/
*
( *
*
(
*
'"
*
[MsmqService]
public class SomeService
{
[MsmqMethod]
public DataSet GetProductsByCategory(int category)
{
string dsn = "server=localhost;uid=…;pwd=…;database=northwind";
string query
= "SELECT * FROM Products WHERE [email protected]";
DataSet response = new DataSet();
using (SqlConnection conn = new SqlConnection(dsn))
{
SqlCommand cmd = new SqlCommand(query, conn);
cmd.Parameters.Add("@CategoryID", SqlDbType.Int);
cmd.Parameters["@CategoryID"].Value = category;
SqlDataAdapter adap = new SqlDataAdapter(cmd);
adap.Fill(response);
}
return response;
}
}
#
*
(
1
/
*
*
*
*
*
*
1
*
1
"
*
*
(
1 (
1
2
*
1
+
*
1
45
1*
/
*
1
(+
(
*
(
( *
*
*
*
/ N *
(
)
I
+
(
1
*
*
*
*
'
"
1
+
+
/
1
*
"
C-"C,"
/
(
1 (
/
1
(
2
*
!
/ (
'
(
(+
I
1
C0,0
2
*
'
*
*
"
*
* 2
1+
?
"
+
MSMQ
290
( *
*
* 2
$
1 +1 (
*
/ ( *
+
C--- +
1
+*
C"J?
*
*
1 1
*
1
'
*
*
1
*
1
+
*
2
C"PG
+"
*
*
*
"
Figuur 10.12 – Workflow voorbeeldapplicatie
!-.
H
*
+1
*
(
/
*
'( *
7
".",8
* (
"
' G"0 * +
*
"
+
5
1
))
4
!
;
(
*
#
(
(
*
#
*
(
* 1+
1
9 "
1
*
1
#2
"
B,D" ;
(+
*
1*
*
(
")
(
(
+
*
2*
#
(+
(
*
1
*
" ; ( +1
/
*
*
(
(
*
(
I
+(
#
(
*
#
(
7
+
5
4
+I
'"
+
( *
"
" ;
*
(
*
/1
*
5
"
(+
*
+
5
*
*
'%
*
*
1
5 *
(
(
"
*
#
2
*
5
*
"
(
;
*
# (
*
*
+" ;
1
1
2
#
KK *
+
*
1
*
1
5
";
+
*
+ (
*
291
(
( + 1
5
5
"
*
21
+
"
1
(
A
")
+F
(+
KK
5
+
E
*
(
5
4
2
EAI: een beschouwing
1
292
(+
/
5
"
1
1+
/
E
*
/
*
(
9
*
*
*
(
*
("
8
*
*
(
*
)
*
*
*
*
(
1
1+
+
*
7
*
(2
1
"
1
*
*
*
*
*
*
(
(
"
(1
*
#
*
*
2
1
(+
1
("
5
*
2*
"; 1
8
5
*
"
<
1
<
5
1
7
*
(
(+ * (
/
*
*
* *
"#
(F
1
(
*
"
1
"
1
+
<
1
/
*
*
"
(
*
'
!
*
*
1
*
:"$
( ++
+
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*
9
/
9
/ (
;
*
*
* 1
!/
*
N
(+
A
/
"
+
*
* 1
*
/ (
"
*
(+
"
(
1(
*
(
*
(( 2
'
/
(+
&
1
(
+
*
*
+ (
/#
(
(
"
4(
"3
3# *
")
"#
*
*
*
(
(
$3 >
(
2
/ (+
*
"
(
4
(
(
4(
(
(
2
1
3#/
*
+
+ 2
/
"
"
1
*
1
"
*
*
1
(+
1
3#/
\
1
(
'%$%&/
"
*
(
(
1
"
(
*
*
*
1
5
" / '% ( +
5
(
+ "
'%$%&
(
@
"
1 (
*
(
,--0
*
*
5
*
/ '% 1
'%
2(
1
(
*
*
*
,--0
*
(
5
"
* *
1 (
(
1
*
1
+
*
(
;
*
+
*
(
*
"
'*
C"
Conclusie
307
*
*
1
E
*
%(
*
"
%(
*
(
# (+
5*
*
*
*
%(
"
(
1
(
1
+
*
(
/
9
*
" ; 1
*
9
*
*
1
*
")
+
+
*
1
(
"
(
9
* (
(
+
#2
(
1
* "
1
/
(
8
*
1
(
/
*
*
1
*
(+ *
1
1
+
(+
*
*
+
1
(
7
1
+
" H
+
/
9
2
"
1
21
*
(
*
5
1
'%L %2
*
*
(
+1
9
(
5*
F*
*
1
(
1
+*
"
( 1+
1
"
2
,--0
4
34
1
,
*
*
(-
")
*
1
*
+
*
1
*
")
1
*
%(
%(
5(
,"-" 3
"
1
(
5" 3
(
1
*
C"4
*
*
*
*
(
%(
5/
1
using System;
using System.Runtime.InteropServices;
class PerformanceTestSample
{
[DllImport("kernel32.dll")]
internal static extern int QueryPerformanceCounter(
out Int64 lpPerformanceCount);
[DllImport("kernel32.dll")]
internal static extern int QueryPerformanceFrequency(
out Int64 lpPerformanceCount);
static void Main(string[] args)
{
long start, stop;
QueryPerformanceCounter(out start);
//plaats code waarvoor performantie gemeten dient te worden hier
QueryPerformanceCounter(out stop);
decimal t = GetSecondsElapsed(start, stop);
}
static decimal GetSecondsElapsed(long start, long stop)
{
long queryFrequency;
QueryPerformanceFrequency(out queryFrequency);
decimal result = Convert.ToDecimal(stop - start)
/ Convert.ToDecimal(queryFrequency);
return Math.Round(result, 6);
}
}
1
1
1
1
*
1 "
*
2
%(
308
5"
4
37
&
&I*
7!
1
4*
1
*
4
$
$
(
*
*
*
(
(
M
C
*
$
,"0"08"
+ *
";
*
"
*
1
(
*
&
*
*
1
*
$
2
/
*
1
F2
*
KK
N 5
*
$O ,"-/
* 1+
1
$
/
(
7
E# *
2
$
*
*
*
$O
*
(
1
*
$
*
/
2
1
(
"
1
'%/
"
/
(
+
$
*
is a strongly typed, data oriented programming language that bridges the gap between between semi-
structured hierarchical data (XML), relational data (SQL), and the .NET Common Type System (CTS). In C ,
the seemingly different worlds of XML, SQL and CTS are bridged and connected through generalization, not
specialization.
+
E1
+1 + $
F1+
7(
$
$c (
"
&
#$
3
( *
* /
1+
"
0
7(!
2
; (&
3
(
1
'%
(
(5
(
5 5
*
309
"
1
*
Comega en de toekomst van de C#-taal
/
310
*
/
C
*
(
1
*
(
"
(
*
"
(
4
(
<
1
7
"C8"
Figuur B.1 – Importeren schema
,
9
*
*
(
1
2
1
*
","
Figuur B.2 – Instellen van de connectie
G
1
(
*
*
*
1
(5
"
(5
"
1
1
*
Comega en de toekomst van de C#-taal
311
Figuur B.3 – Genereren van de assembly
+
*
*
*
1
+
(
(
*
*
/
*
(5
"
(
(
(
(
(
1
)
1
"
*
*
+
*
(5
1
*
*
"
7((
1
( 5*
((
*
*
".8" 3
(
*
2
+
E
(
1
2*
*
1
* 2
(+
(+ E
F
(
1
1
Database dbo = new Database(dsn);
foreach (row in select * from dbo.Products)
Console.WriteLine(row.ProductName);
F7
(
(
#
(
*
*
1
"
(+
Comega en de toekomst van de C#-taal
312
Figuur B.4 – Databasetoegang
;
*
*
2
* 1
2
Figuur B.5 – Uitvoer van de voorbeeldapplicatie
;
*
(
(
*
*
1
*
*
(
1
1
+
E
1
F"
*
2
$
* 1
/
(
(
(
"
(
*
*
(
*
decimal price = 10M;
foreach (row in select * from dbo.Products
where UnitPrice < price
order by ProductName)
Console.WriteLine("{0}\t{1}", row.ProductName, row.UnitPrice);
N 5/
/
Comega en de toekomst van de C#-taal
( *
*
+
(
(
313
1
*
*
*
*
(
5
1
5
1
+
*
N$
*
*
(
2
$
/
1
" ;
1
* "
$
(
(
1
(52
*
1
1 "
*
*
2 + 2
(
"
"
2
" 1
N 5
1
*
#
2
(
5
(
N ( 5
(
"
( +KK
+
*
int id = …;
row = select singleton ProductName, UnitPrice from dbo.Products
where ProductID == id;
decimal price = row.UnitPrice;
string product = row.ProductName;
(+
*
(
+
*
+
7(/
E 1F
*
(
5
"
5
1
"3
"
0"$
)
*
*
*
(
/2
$
*
/
1
/
="
*
*
(
*
*
*
insert ProductName="Test" into dbo.Products;
update dbo.Products set ProductName="SomeTest" where ProductName == "Test";
delete from dbo.Products where ProductName == "SomeTest";
;
(
1
2
"
*
"#
=2
" 1
5
(+
*
2
(
2
Comega en de toekomst van de C#-taal
314
7(8
+
*
$
(
/
"H
(+
*
(
+
*
+
*
Database dbo = new Database(dsn);
transact(dbo)
{
insert ProductName="Test" into dbo.Products;
rollback;
}
commit
{
Console.WriteLine("Committed");
}
rollback
{
Console.WriteLine("Rolled back");
}
7(.
&
;
(
1
*
( *
9
(
(+
+1
*
(
"
*
*
*
* (
1
"
$
*
*
(
(
*
* (
+ (
3A&/
(
(
* +
*
*
1
3(+
+
*
$O G"-/
+* (
"
+
1
(
9
$
+
(
(
(+ /
"
4
3&
&
=-
&!
;
;
!AC"C/
*
/
/
1 (
(
1
"
*
"
4
*
"L %
/
*
*
"
*
+
1
&
(
(
*
(
7
1
*
(+
7( +
*
(
"
(
";
(
*
@
+
(
?"*
# !")
*
2 1
/
(
=2
1 (
.
.
(
"
5
(
(
*
#! /
7
*
*
1
2
8"
(+
*
*
"
*
*
(
(
1
1
1 (
.
"
"
(
(
"
1
+
1
*
; (
*
*
"
*
C
*
(
(+
"
*
(
+2 1
*
*
5
* ";
(
/
1
8
+ # !/
(+
1
*
1
*
* 1
&(
!/
?"- (
*
*
;
*
1
?"-
/
#! = " 3
/
(
*
1
(
(
$"C"
315
*
2
Compressie in IIS 6.0
316
Figuur C.1 – Toevoeging van de Gzip-extensie
;
*
*
1
/ 4
4
*
(
"
*
E
*
$",
1
*
7
8
F
*
*
"
Figuur C.2 – Resultaat na toevoeging van de Gzip-extensie
7
@
1
*
4
?"-
4
( *
$ "
*
1 (
* "
Compressie in IIS 6.0
, $
317
*
; 1
*
*
*
(
*
1 (
*
/
.
(
* 2
$
( *
1+
*
1
1+ "
+
1
"
Figuur C.3 – Inschakelen van compressie zonder configuratie
;
(
*
1
1+
7
?"-
"
@
!
7
$"G8
*
*
"
(
(
*
/
*
(
+
* "
*UU
*
1
*
1+
1
0"
'''
"
*
C"
," 3
2(+
*
(
(
*
(
*
"4
$
[1
*
[` 5
A
G,`
** )
"
"
Compressie in IIS 6.0
318
G" %
^ $
1+
_ *
+1
/
*
*
<IIsCompressionScheme Location ="/LM/W3SVC/Filters/Compression/gzip"
HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
HcCreateFlags="1"
HcDoDynamicCompression="TRUE"
HcDoOnDemandCompression="TRUE"
HcDoStaticCompression="TRUE"
HcDynamicCompressionLevel="9"
HcFileExtensions="htm
html
txt"
HcOnDemandCompLevel="10"
HcPriority="1"
HcScriptFileExtensions="asp
dll
exe
asmx"
>
7
@
1
(
*
1
4
( *
("
3
1
4
"
4"
;
+ 1
/
5
*
$
* 9
*
% *
-
C-" ;
1
(
(
1
."
*
*
(
*
1
/
/
*
*
1
"
*
1"
P( *
*
"
1
"
1
1
*
1+
adsutil set w3svc/#site#/root/#vdir#/DoDynamicCompression true
;
O
*
*
1 (
;
O
* *
" O*
*
1
"*(
*
O
1 (
1
*
*
1
*
"
2
*
1 (
";
*
1
(
*
1 (
(`#
"
"
Compressie in IIS 6.0
0" ;
)
319
*
*
*
$
*
*
*
1
*
5
(
*
*
/
"
1
"
*
*
(
,--G
1
2
1
"
*
?"-
+ *2
(
&/
1 (
"
) 1
+
1
#
A
*
4
*
1
BCPD2 ( " ?0./??G"
5
(+ 1 (
"
D
;
(
*
;
(
1 (
*
*
*
(
+
(
;
(
!/
*
*
"
2
*
/
*
1
1
1
*
"3
3#!/(
*
2
1
2
1+
+
5
*
1
*
#
(
2
*
1
/(
(
1K
" ;
(
(
"3
*
3#!/(
5
(+
*
((
K
5/
(
*
KK
*
(
!/ *
(
5
."
*
1
" ;
(
*
* 1
*
/
9
7
[1]
Patterns of Enterprise Application Architecture – M. Fowler – Addison Wesley – 2003
[2]
Enterprise integration solutions – D. Spackman, M. Speaker – Microsoft Press – 2004
[3]
Software architectuur – A. Verkeynlx – A. Verkeyn – 2003
[4]
Professional Windows DNA – M. Bortniker et al – Wrox Press – 2000
[5]
Microsoft .NET Remoting – S. McLean, J. Naftel, K. Williams – Microsoft Press – 2002
[6]
An Introduction to Database Systems 8th edition – C.J. Date – Addison Wesley – 2004
[7]
Writing Secure Code 2nd edition – M. Howard, D. LeBlanc – Microsoft Press – 2002
[8]
Enterprise Library Documentation – Microsoft Patterns & Practices – Microsoft – 2005
[9]
Applied Microsoft .NET Framework Programming – J. Richter – Microsoft Press –
2002
[10] A First Look at SQL Server 2005 for Developers – B. Beauchemin, N. Berglund, D.
Sullivan – Addison Wesley – 2004
[11] Expert Service-Oriented Architecture in C# – J. Hasan – Apress – 2004
[12] Web Services Enhancements 2.0 for Microsoft .NET – Microsoft – 2004
[13] MSDN Library – Microsoft – January 2005
[14] Platform SDK Documentation – Microsoft – February 2003
[15] Design patterns – E. Gamma et al (“The Gang of Four”) – Addison Wesley – 1995
[16] ADO.NET and System.Xml v. 2.0 – The beta version – A. Homer, D. Sussman, M.
Fussell – Addison Wesley – 2005
[17] .NET Windows Forms: intelligente kolommen voor de DataGrid – M. De Geest –
UGent – 2004
[18] Microsoft .NET Distributed Applications: Integrating XML Web Services and .NET
Remoting – M. MacDonald – Microsoft Press – 2003
[19] Internet Information Services (IIS) 6.0 Resource Kit – The Microsoft IIS Team –
Microsoft Press – 2003
[20] ASP.NET v. 2.0 – The Beta Version – A. Homer, D. Sussman, R. Howard – Addison
Wesley – 2005
[21] Improving .NET Application Performance and Scalability – Microsoft Patterns &
Practices – Microsoft – 2004
320
Referenties
*
i
321
5
6
ICORDA is een Belgisch bedrijf dat onder andere gespecialiseerd is in softwareoplossingen voor bedrijven.
Meer informatie over de diensten van ICORDA kan gevonden worden op http://www.icorda.be.
ii
Zie http://www.gandagas.be voor meer informatie over dit bedrijf.
iii
Diverse bronnen:
- TheServerSide – J2EE vs. Microsoft.NET – http://www.theserverside.com
- GotDotNet – .NET vs. J2EE – http://www.gotdotnet.com/team/compare/default.aspx
iv
GotDotNet – Microsoft .NET Pet Shop version 1.5 – http://www.gotdotnet.com/team/compare/petshop.aspx
v
Microsoft Virtual Server 2005 –
http://www.microsoft.com/windowsserversystem/virtualserver/default.mspx
vi
MSDN Blogs – Scott Densmore – http://blogs.msdn.com/scottdensmore/archive/2005/03/15/396365.aspx
vii
Microsoft Download Center – “CLR Profiler (2.0)” – http://www.microsoft.com/downloads
viii
DevX Articles – http://www.devx.com/codemag/Article/27094
ix
Mono project homepage – http://www.mono-project.com
x
MSDN – “ECMA and ISO/IEC C# and Common Language Infrastructure Standards” –
http://msdn.microsoft.com/net/ecma
xi
Web Service Interoperability Organization (WS-I) – http://www.ws-i.org
xii
.NET Languages – http://www.dotnetlanguages.net
xiii
WinFX Software Developer Kit – http://winfx.msdn.microsoft.com/library
xiv
MSDN – “Features overview for Visual Studio .NET 2003” –
http://msdn.microsoft.com/vstudio/productinfo/features
xv
MSDN Lab – Visual Studio 2005 Express Products – http://lab.msdn.microsoft.com/express
xvi
MSDN – “C# Language Home Page” – http://msdn.microsoft.com/vcsharp/language
xvii
Microsoft Download Center – “Enterprise Library” – http://www.microsoft.com/downloads
xviii
MSDN Blogs (Scott Densmore) – “Enterprise Library and .NET 2.0” –
http://blogs.msdn.com/scottdensmore/archive/2005/03/15/396365.aspx
xix
MSDN – “A First Look at SQL Server 2005 Service Broker” –
http://msdn.microsoft.com/sql/2005/2005articles/default.aspx?pull=/library/enus/dnsql90/html/sqlsvcbroker.asp
xx
Transaction Processing Performance Council – http://www.tpc.org
xxi
Een open implementatie van TDS versies 4.2 tot 8.0 is beschikbaar via http://www.freetds.org
xxii
MSDN Security Center – http://msdn.microsoft.com/security
xxiii
SQL Server Magazine – “The .NET Connection Pool Lifeguard” –
http://msdn.microsoft.com/library/en-us/dnsqlmag03/html/The_NETConnectionPoolLifeguard.asp
xxiv
SQL-Server-Performance.Com – http://www.sql-server-performance.com
xxv
.NET Framework Developers Guide – “Introduction to Isolated Storage” –
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconintroductiontoisolatedstorage.asp
xxvi
MSDN Belux (Bart De Smet) – “Database cache invalidation in ASP.NET Whidbey” –
http://www.microsoft.com/belux/nl/msdn/community/columns/desmet/dbcacheinvalidation.mspx
xxvii
MSDN Library – “Blittable and Non-Blittable Types” –
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconblittablenon-blittabletypes.asp
xxviii
Julia Lerman Blog – “Bulk copy in ADO.NET 2.0 – pop quiz” –
http://www.thedatafarm.com/blog/PermaLink.aspx?guid=15cf7a6c-d3d9-4633-8f69-6bbf62a4d33e
xxix
MSDN (Christian Kleinerman) – “Multiple Active Result Sets (MARS) in SQL Server 2005” –
http://msdn.microsoft.com/ library/en-us/dnsql90/html/MARSinSQL05.asp
xxx
MSDN (Beta) – “Special Considerations When Using Query Notifications” –
http://msdn2.microsoft.com/library/aewzkxxh(en-us,vs.80).aspx
xxxi
ADO.NET 2.0 “Whidbey” Beta Newsgroup – microsoft.private.whidbey.adodotnet
xxxii
MSDN (Beta) – “Performing Batch Updates with a DataAdapter” –
http://msdn2.microsoft.com/library/kbbwt18a(en-us,vs.80).aspx
xxxiii
MSDN Library – “.NET Framework Class Library – DataRowState Enumeration” –
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemdatadatarowstateclasstopic.asp
xxxiv
Microsoft PressPass – Persbulletin 19/04/05 –
http://www.microsoft.com/presspass/press/2005/apr05/04-19oasisstandardizationpr.asp
xxxv
Clemens Vasters Blog – http://staff.newtelligence.net/clemensv/
Referenties
xxxvi
322
MSDN (David S. Platt ) – “Send MSMQ Messages Securely Across the Internet with HTTP and SOAP” –
http://msdn.microsoft.com/msdnmag/issues/03/12/MSMQandNET/toc.asp
xxxvii
Eggheadcafe (Peter A. Bromberg) – “Message Queue over HTTP: Usage Scenarios” –
http://www.eggheadcafe.com/articles/20040620.asp
xxxviii
MSDN TV (Don Box) – “SOAP: Service-Oriented Architecture and Programming” –
http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20030827soapdb/manifest.xml en
http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20030902soapdb/manifest.xml
xxxix
Don Box’s Spoutlet - http://www.pluralsight.com/blogs/dbox/default.aspx
xl
MSDN (David Chappell) – “Introducing Indigo: An Early Look” –
http://msdn.microsoft.com/Longhorn/understanding/pillars/Indigo/default.aspx?pull=/library/enus/dnlong/html/introindigov1-0.asp
xli
MSDN Magazine January 2004 (Don Box) – “A Guide to Developing and Running Connected Systems with
Indigo” – http://msdn.microsoft.com/msdnmag/issues/04/01/Indigo/default.aspx
xlii
MSDN Homepage voor SQLXML – http://msdn.microsoft.com/sqlxml
xliii
dBforums – Forum post “SQLXML 3.0 SP3 "Internal server error: Error parsing SOAP configfile" on
Win2003” – http://www.dbforums.com/t1116904.html
xliv
Microsoft Download Center – “SOAP Toolkit 3.0” –
http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-975386F052EC8450&displaylang=en
xlv
MSDN Library – “Implementing a .NET Framework Data Provider” –
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconImplementingNETdataProvider.asp
xlvi
MSDN – “Visual Studio Extensibility Center” – http://msdn.microsoft.com/vstudio/extend/
xlvii
Blog Florin Lazar – http://blogs.msdn.com/florinlazar
xlviii
Blog Transactional NTFS team – http://blogs.msdn.com/because_we_can
xlix
MSDN – “Using ASP.NET Session State in a Web Service” –
http://msdn.microsoft.com/library/en-us/dnservice/html/service08062002.asp
l
MSDN – “Web Services Atomic Transaction (WS-Atomic Transaction)” –
http://msdn.microsoft.com/library/en-us/dnglobspec/html/WS-AtomicTransaction.pdf
li
IBM – “Business Process Execution Language for Web Services Version 1.1” –
ftp://www6.software.ibm.com/software/developer/library/ws-bpel.pdf
lii
The Code Project (Roman Kiss) – “Using MSMQ for Custom Remoting Channel” –
http://www.codeproject.com/csharp/msmqchannel.asp en
http://www.codeproject.com/csharp/MSMQChannelNew.asp
liii
Microsoft Download Center – “MSMQ version 3.5 for "Indigo"” –
http://www.microsoft.com/downloads/details.aspx?familyid=00e76c8a-e571-440e-929fdc748136a886&displaylang=en
liv
MSDN Belux Presentations – “SQL Server 2000 Notification Services” (Bart De Smet) –
http://www.microsoft.com/belux/nl/msdn/events/presentations.mspx
lv
Microsoft Research – Homepage Comega – http://research.microsoft.com/comega/
lvi
Bart De Smet Blog – “Adventures in Comega” – http://blogs.bartdesmet.net/bart/category/40.aspx
lvii
ASP.NET Weblogs (Sudhakar Sadasivuni) – “How To: HTTP Compression in IIS 6.0” –
http://weblogs.asp.net/ssadasivuni/archive/2003/12/10/42448.aspx
lviii
ASP.NET Weblogs (Scott Forsyth) – “IIS Compression in IIS6.0” –
http://weblogs.asp.net/owscott/archive/2004/01/12/57916.aspx
lix
MSDN Belux (Bart De Smet) – “Compression support in ASP.NET 2.0” –
http://www.microsoft.com/belux/nl/msdn/community/columns/desmet/compression.mspx
lx
Andy Verkeyn homepage – http://users.skynet.be/averkeyn/computer/download/softarch.pdf