DataAdapter.cs 2.0 KB

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