Sommario

annuncio pubblicitario
Sommario
Ringraziamenti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XV
Introduzione . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . XVII
Parte I
Conoscere ADO.NET
Introduzione ad ADO.NET 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1
Cos’è ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Perché ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Componenti principali di ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Estensioni di ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Connessione a dati esterni . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2
Creare tabelle di dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Implementare le tabelle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Implementazioni logiche e fisiche delle tabelle . . . . . . . . . . . . . . . . . . . 17
La classe DataTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Aggiungere colonne di dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Progettazione DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3
Inserire i dati in memoria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Aggiungere dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Creare nuove righe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Definire i valori delle righe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Memorizzare righe in una tabella . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Esaminare e modificare i dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Rimuovere dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
00 Ado.indd 7
VII
30/03/11 11:16
VIII
Sommario
Elaborazione in batch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Stato della riga . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Versioni della riga . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Convalidare le modifiche . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Errori basati su eccezioni . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Errori basati sulla convalida . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
4
Accedere ai dati in modo mirato . . . . . . . . . . . . . . . . . . . . . . . . . 59
Interrogare e ordinare i dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Trovare righe utilizzando la chiave primaria . . . . . . . . . . . . . . . . . . . . . . 60
Selezionare righe con un criterio di ricerca . . . . . . . . . . . . . . . . . . . . . . . 62
Ordinare i risultati delle ricerche . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Eseguire ricerche sensibili alle maiuscole . . . . . . . . . . . . . . . . . . . . . . . . . 67
Utilizzare le colonne espressione . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
5
Mettere insieme i dati correlati . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Riunire le tabelle in set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Impostare relazioni fra le tabelle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Comprendere le relazioni fra tabelle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Creare relazioni fra i dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Individuare record padre e figlio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Definire vincoli sulle tabelle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
6
Trasformare i dati in informazioni . . . . . . . . . . . . . . . . . . . . . . . 89
Aggregare i dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Generare una singola aggregazione . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Aggiungere una colonna aggregata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Aggregare dati fra tabelle correlate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Fare riferimento ai campi padre nelle espressioni . . . . . . . . . . . . . . . . . 98
00 Ado.indd 8
30/03/11 11:16
Sommario
IX
Impostare viste indicizzate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Creare un DataView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Utilizzare un DataView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
7
Salvare e ripristinare i dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Serializzare gli oggetti DataSet e DataTable . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Scrivere l’XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Leggere l’XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Guidare la generazione dell’XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Identificare gli spazi dei nomi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Nidificare le tabelle figlio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Gestire e posizionare le colonne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Parte II
Connessione a origini dati esterne
Stabilire connessioni esterne . . . . . . . . . . . . . . . . . . . . . . . . . . 121
8
Utilizzare le stringhe di connessione . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Stringhe di connessione SQL Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Stringhe di connessione OLE DB e ODBC . . . . . . . . . . . . . . . . . . . . . . . . 124
Costruttori di stringhe di connessione . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Memorizzare le stringhe di connessione . . . . . . . . . . . . . . . . . . . . . . . . 126
Comprendere i data provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Connettersi a SQL Server tramite un data provider . . . . . . . . . . . . . . . . . . . . 127
Creare e aprire connessioni . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Pooling delle connessioni . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
9
Eseguire query sui database . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Elaborare query SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Creare oggetti command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Elaborare le query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Elaborazione asincrona . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
00 Ado.indd 9
30/03/11 11:16
X
Sommario
Restituire risultati di query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Restituire un singolo valore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Restituire righe di dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Accedere ai valori dei campi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Elaborare risultati più complessi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
10
Aggiungere parametri alle query . . . . . . . . . . . . . . . . . . . . . . 153
Sviluppare query parametrizzate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
A cosa servono i parametri . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Implementare query standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Utilizzare parametri con altri provider . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Utilizzare parametri nelle stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
11
Rendere i dati esterni disponibili localmente . . . . . . . . . . . . 169
Comprendere i data adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Spostare i dati dall’origine alla memoria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Spostare i dati in un DataTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Spostare i dati in un DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Spostare i dati dalla memoria all’origine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Configurare i comandi di aggiornamento . . . . . . . . . . . . . . . . . . . . . . . 175
Eseguire l’aggiornamento . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
Generare comandi di aggiornamento automaticamente . . . . . . . . . . 180
Mapping di tabelle e colonne . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
12
Garantire l’integrità dei dati . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Transazioni e concorrenza . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Utilizzare le transazioni locali . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
Utilizzare i punti di salvataggio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Utilizzare le transazioni distribuite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
00 Ado.indd 10
30/03/11 11:16
Sommario
Parte III Entity
13
XI
Framework
Introduzione a Entity Framework . . . . . . . . . . . . . . . . . . . . . . 213
Comprendere Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Terminologia relativa a Entity Framework . . . . . . . . . . . . . . . . . . . . . . . 215
I livelli di Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Il modello concettuale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Il modello di archiviazione . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Il mapping del modello . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Utilizzare Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Costruire il modello . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Generare gli oggetti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Istanziare il contesto . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
Eseguire query nel Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
14
Visualizzare i modelli di dati . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Progettare un modello Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Utilizzare la Procedura guidata Entity Data Model . . . . . . . . . . . . . . . . 225
Entity Data Model Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Lavorare con il pannello Dettagli Mapping . . . . . . . . . . . . . . . . . . . . . . 235
Utilizzare il Browser modello . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Gestire il livello oggetti . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
15
Interrogare i dati nel Framework . . . . . . . . . . . . . . . . . . . . . . 245
Conoscere Entity SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Scrivere query semplici . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Utilizzare letterali, operatori ed espressioni . . . . . . . . . . . . . . . . . . . . . . 249
Raggruppare e aggregare i dati di entità . . . . . . . . . . . . . . . . . . . . . . . . 252
Utilizzare le funzionalità esclusive di Entity SQL . . . . . . . . . . . . . . . . . . 254
Eseguire query Entity SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Eseguire query utilizzando un ObjectQuery . . . . . . . . . . . . . . . . . . . . . 256
Eseguire query utilizzando un provider . . . . . . . . . . . . . . . . . . . . . . . . . 260
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
00 Ado.indd 11
30/03/11 11:16
XII
Sommario
16
Comprendere le entità attraverso gli oggetti . . . . . . . . . . . . 267
Gestire i dati di entità attraverso gli oggetti . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Accedere ai dati di entità attraverso gli oggetti . . . . . . . . . . . . . . . . . . 268
Modificare i dati di entità attraverso gli oggetti . . . . . . . . . . . . . . . . . . 271
Utilizzare i metodi query builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Metodi di estensione queryable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Parte IV LINQ
17
Introduzione a LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Conoscere LINQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Utilizzare LINQ con oggetti .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Avviare una query con la clausola From . . . . . . . . . . . . . . . . . . . . . . . . . 293
Proiezione dei risultati con la clausola Select . . . . . . . . . . . . . . . . . . . . . 293
Filtrare i risultati con la clausola Where . . . . . . . . . . . . . . . . . . . . . . . . . 295
Ordinare i risultati con la clausola Order By . . . . . . . . . . . . . . . . . . . . . . 296
Selezionare risultati collegati con la parola chiave Join . . . . . . . . . . . . 297
Limitare il contenuto interrogato . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
Riepilogare i dati tramite aggregazioni . . . . . . . . . . . . . . . . . . . . . . . . . 301
Eseguire operazioni su insiemi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
18
Utilizzare LINQ to DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Comprendere il provider LINQ to DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
Scrivere query con LINQ to DataSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
19
Utilizzare LINQ to Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Comprendere il provider LINQ to Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Scrivere query con LINQ to Entities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Lavorare con le funzioni di entità e di database . . . . . . . . . . . . . . . . . . 321
Lavorare con le funzioni di database personalizzate . . . . . . . . . . . . . . 324
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
00 Ado.indd 12
30/03/11 11:16
Sommario
20
XIII
Utilizzare LINQ to SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Comprendere il provider LINQ to SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Confronto fra LINQ to SQL e LINQ to Entities . . . . . . . . . . . . . . . . . . . . 332
Comprendere i componenti di LINQ to SQL . . . . . . . . . . . . . . . . . . . . . 333
Utilizzare Progettazione relazionale oggetti . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Utilizzare funzioni di database personalizzate nelle query . . . . . . . . . . . . . . 339
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343
Parte V
Presentazione dei dati
21
Associare i dati con ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . 347
Associazione dati in Windows Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
Creare applicazioni con associazione dati complessa . . . . . . . . . . . . . 348
Creare applicazioni con associazione dati semplice . . . . . . . . . . . . . . . 351
Comprendere l’associazione dati di Windows Forms . . . . . . . . . . . . . . 352
Associazione dati in WPF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Creare applicazioni WPF associate ai dati . . . . . . . . . . . . . . . . . . . . . . . 354
Comprendere l’associazione dati in WPF . . . . . . . . . . . . . . . . . . . . . . . . 360
Associazione dati in ASP.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Creare applicazioni ASP.NET associate ai dati . . . . . . . . . . . . . . . . . . . . 362
Comprendere l’associazione dati in ASP.NET . . . . . . . . . . . . . . . . . . . . . 364
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
22
Fornire servizi basati su REST
con WCF Data Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Conoscere i livelli servizi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Introduzione a WCF Data Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Introduzione a REST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
Configurare un servizio dati . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Definire i diritti per i servizi . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Accedere a un servizio dati utilizzando REST . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Interrogare le entità con REST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Aggiornare le entità con REST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Riepilogo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
Procedure in breve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
00 Ado.indd 13
Indice analitico . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
L’autore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
30/03/11 11:16
Scarica