2002-05-11 Tim Coleman
[mono.git] / mcs / class / System.Data / System.Data.Common / DataAdapter.cs
1 //
2 // System.Data.Common.DataAdapter
3 //
4 // Author:
5 //   Rodrigo Moya (rodrigo@ximian.com)
6 //
7 // (C) Ximian, Inc
8 //
9
10 using System.ComponentModel;
11 using System.Data;
12
13 namespace System.Data.Common
14 {
15         /// <summary>
16         /// Represents a set of data commands and a database connection that are used to fill the DataSet and update the data source.
17         /// </summary>
18         public abstract class DataAdapter : Component // , IDataAdapter
19         {
20                 private bool acceptChangesDuringFill;
21                 private bool continueUpdateOnError;
22                 private MissingMappingAction missingMappingAction;
23                 private MissingSchemaAction missingSchemaAction;
24                 private DataTableMappingCollection tableMappings;
25
26                 protected DataAdapter () {
27                         acceptChangesDuringFill = false;
28                         continueUpdateOnError = false;
29                         missingMappingAction = MissingMappingAction.Error;
30                         missingSchemaAction = MissingSchemaAction.Error;
31                         tableMappings = null;
32                 }
33                 
34                 public abstract int Fill (DataSet dataSet);
35
36                 public abstract DataTable[] FillSchema (DataSet dataSet,
37                                                         SchemaType schemaType);
38
39                 public abstract IDataParameter[] GetFillParameters ();
40
41                 public abstract int Update (DataSet dataSet);
42
43                 protected virtual DataAdapter CloneInternals ()
44                 {
45                         throw new NotImplementedException ();
46                 }
47
48                 protected virtual DataTableMappingCollection CreateTableMappings ()
49                 {
50                         throw new NotImplementedException ();
51                 }
52
53                 protected virtual bool ShouldSerializeTableMappings ()
54                 {
55                         throw new NotImplementedException ();
56                 }
57                 
58                 public bool AcceptChangesDuringFill {
59                         get {
60                                 return acceptChangesDuringFill;
61                         }
62                         set {
63                                 acceptChangesDuringFill = value;
64                         }
65                 }
66
67                 public bool ContinueUpdateOnError {
68                         get {
69                                 return continueUpdateOnError;
70                         }
71                         set {
72                                 continueUpdateOnError = value;
73                         }
74                 }
75
76                 public MissingMappingAction MissingMappingAction {
77                         get {
78                                 return missingMappingAction;
79                         }
80                         set {
81                                 missingMappingAction = value;
82                         }
83                 }
84
85                 public MissingSchemaAction MissingSchemaAction {
86                         get {
87                                 return missingSchemaAction;
88                         }
89                         set {
90                                 missingSchemaAction = value;
91                         }
92                 }
93
94                 public DataTableMappingCollection TableMappings {
95                         get {
96                                 if (tableMappings == null)
97                                         tableMappings = CreateTableMappings ();
98                                 return tableMappings;
99                         }
100                 }
101         }
102 }