DataAdapter.cs 2.1 KB

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