Introduzione a ADO.NET Silvano Coriani Developer & Platform Evangelism MCTrainer MCSDeveloper MCADeveloper MCSEInternet MCDBA 1 /28 Da dove iniziare... 2 /28 .NET Data Access Overview 3 /28 .NET Data Access Overview 4 /28 .NET Data Access Overview 5 /28 Da ADO 2.x a ADO.NET Command XxxTransaction XxxCommand DataSet Recordset XxxDataReader XxxDataAdapter 6 /28 ADO.NET ADO Connection XxxConnection Architettura applicativa 7 /28 .NET Data Provider • connessaCommand 8 /28 .NET Data Provider • DataAdapter • DataReader 9 /28 .NET Application DataSet System.Data.Oracle System.Data.SqlClient System.Data.OleDb System.Data.Odbc OLE DB OLE DB Provider ODBC Oracle SQL Server Other DBMS Non-relational sources 10 /28 I componenti di ADO.NET .NET Data Provider .NET Data Storage Connection DataSet Command DataTables DataAdapter XMLData DataReader XMLDataSchema Data Source XML 11 /28 ADO.NET in uno scenario connesso XxxDataReader XxxCommand XxxConnection Data 12 /28 DEMO 13 /28 Architettura Connessa vs. Disconnessa • DataAdapterDataSet 14 /28 ADO.NET in uno scenario disconnesso DataSet XxxDataAdapter XxxConnection Data 15 /28 Architettura Connessa vs. Disconnessa 16 /28 DEMO 17 /28 DataSet: Intro 18 /28 DataSet: Intro • Basato su un paradigma a “collezioni” – DataRow come collezione di campi/colonne – DataTable come collezione di DataRow – DataRelations come collezione di relazioni tra le DataTables – Constraints • array based 19 /28 DataSet: Intro • schema XSDMarshalByValueObjectISerializable 20 /28 DataSet Object Model DataSet DataTableCollection DataRelationsCollection DataRelation DataTable DataTable DataTable ConstraintCollection DataColumn DataRow Constraint DataRowCollection DataColumnCollection DataRow DataColumn 21 /28 Popolare il DataSet • DataAdapterstruttura via codice 22 /28 DataAdapter 23 /28 Architettura del DataAdapter Select SqlCommand SqlCommandBuilder SqlDataAdapter Insert SqlCommand SqlConnection Update SqlCommand Delete SqlCommand Data DataSet 24 /28 Architettura del DataAdapter XxxDataAdapter SelectCommand UpdateCommand InsertCommand DeleteCommand XxxCommand XxxCommand XxxCommand XxxDataReader XxxCommand XxxConnection sp_SELECT sp_UPDATE sp_INSERT sp_DELETE 25 /28 Ma dobbiamo scrivere tutto a mano? 26 /28 DEMO 27 /28 In sintesi 28 /28 News 29 /28 30 /28