private void btnGetDatabase_Click(object sender, EventArgs e) { Director director = new Director(); IDatabaseBuilder builder; if (radUseSqlServer.Checked) { builder = new SqlServerDatabaseBuilder(); } else { builder = new OledbDatabaseBuilder(); } director.Build(builder); AbstactDatabase database = builder.Database; DbCommand command = database.Command; command.CommandText = "Select * from Customers"; command.Connection.Open(); DbDataReader reader = command.ExecuteReader(); reader.Close(); command.Connection.Close(); }
public OledbDatabaseBuilder() { _Database = new OledbClass(); }
public SqlServerDatabaseBuilder() { _Database = new SqlServerClass(); }