DataAdapter.cs 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //
  2. // System.Data.Common.DataAdapter
  3. //
  4. // Author:
  5. // Rodrigo Moya ([email protected])
  6. // Tim Coleman ([email protected])
  7. //
  8. // (C) Ximian, Inc
  9. // Copyright (C) 2002 Tim Coleman
  10. //
  11. using System.ComponentModel;
  12. using System.Data;
  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. #region Fields
  21. private bool acceptChangesDuringFill;
  22. private bool continueUpdateOnError;
  23. private MissingMappingAction missingMappingAction;
  24. private MissingSchemaAction missingSchemaAction;
  25. private DataTableMappingCollection tableMappings;
  26. #endregion
  27. #region Constructors
  28. protected DataAdapter ()
  29. {
  30. acceptChangesDuringFill = true;
  31. continueUpdateOnError = false;
  32. missingMappingAction = MissingMappingAction.Passthrough;
  33. missingSchemaAction = MissingSchemaAction.Add;
  34. tableMappings = new DataTableMappingCollection ();
  35. }
  36. #endregion
  37. #region Properties
  38. public bool AcceptChangesDuringFill {
  39. get { return acceptChangesDuringFill; }
  40. set { acceptChangesDuringFill = value; }
  41. }
  42. public bool ContinueUpdateOnError {
  43. get { return continueUpdateOnError; }
  44. set { continueUpdateOnError = value; }
  45. }
  46. public MissingMappingAction MissingMappingAction {
  47. get { return missingMappingAction; }
  48. set { missingMappingAction = value; }
  49. }
  50. public MissingSchemaAction MissingSchemaAction {
  51. get { return missingSchemaAction; }
  52. set { missingSchemaAction = value; }
  53. }
  54. public DataTableMappingCollection TableMappings {
  55. get { return tableMappings; }
  56. }
  57. ITableMappingCollection IDataAdapter.TableMappings {
  58. get { return TableMappings; }
  59. }
  60. #endregion
  61. #region Methods
  62. [MonoTODO]
  63. protected virtual DataAdapter CloneInternals ()
  64. {
  65. throw new NotImplementedException ();
  66. }
  67. protected virtual DataTableMappingCollection CreateTableMappings ()
  68. {
  69. tableMappings = new DataTableMappingCollection ();
  70. return tableMappings;
  71. }
  72. [MonoTODO]
  73. protected override void Dispose (bool disposing)
  74. {
  75. throw new NotImplementedException ();
  76. }
  77. public abstract int Fill (DataSet dataSet);
  78. public abstract DataTable[] FillSchema (DataSet dataSet, SchemaType schemaType);
  79. public abstract IDataParameter[] GetFillParameters ();
  80. [MonoTODO]
  81. protected virtual bool ShouldSerializeTableMappings ()
  82. {
  83. throw new NotImplementedException ();
  84. }
  85. public abstract int Update (DataSet dataSet);
  86. #endregion
  87. }
  88. }