public DataSet GetVendors() { VendorDataSet ds = new VendorDataSet(); mmDataAccessBase dao = this.GetDataAccessObject(); IDataAdapter da = dao.CreateDataAdapter(); da.Fill(ds); return ds; }I get the distinct feeling that I am supposed be using the "this.FillDataSet(ds,...)" method instead of the "da.Fill(ds)" method.
public DataSet GetVendors() { VendorDataSet ds = new VendorDataSet(); mmDataAccessBase dao = this.GetDataAccessObject(); this.FillDataSet(ds,GetVendorSelectCommand()); return ds; } private IDbCommand GetVendorSelectCommand() { IDbCommand cmd = new System.Data.SqlClient.SqlCommand(); cmd.CommandText = "SELECT * FROM Vendor"; cmd.CommandType = System.Data.CommandType.Text; return cmd; }but I don't see the point in making a new SqlCommand that is redudant with IDataAdapter.SelectCommand. (Also, this approach is not data-source agnostic, since it uses System.Data.SqlClient.SqlCommand, because System.Data.IDbCommand is abstract and cannot be instantiated here.)
public DataSet GetVendors() { VendorDataSet ds = new VendorDataSet(); mmDataAccessBase dao = this.GetDataAccessObject(); this.FillDataSet(ds,dao.GetSelectCommand()); return ds; }But this seems convoluted as well, since my business object is already has visibility to my data access object (VendorDataAccessSql), and the SqlDataAdapter within my data access object already knows how to fill a DataSet (via the IDataAdapter.Fill(ds) method). So it seems like I'm going to a lot of trouble just to tell my custom data access class something it already knows (how to fill a DataSet).