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); Database database = builder.Database; DbCommand command = database.Command; // now, we can do something, like: //command.CommandText = "SELECT * FROM Customers"; //command.Connection.Open(); //DbDataReader reader = command.ExecuteReader(); //reader.Close(); //command.Connection.Close(); }
static void Main() { Builder b1 = new ConcreteBuilder1(); Director director = new Director(); director.Construct(b1); var p1 = b1.GetResult(); p1.Show(); }
public static void Main() { Builder builder = new ConcreteBuilder(); Director director = new Director(builder); director.Construct(); Product product = builder.GetResult(); product.Show(); }
static void Main(string[] args) { VeiculoBuilder builder; var director = new Director(); builder = new CarroBuilder(); director.Construir(builder); builder.Veiculo.Mostrar(); builder = new MotoBuilder(); director.Construir(builder); builder.Veiculo.Mostrar(); Console.ReadLine(); }
static void Main(string[] args) { Director director = new Director(); Builder b1= new ConcreteBuilder1(); Builder b2 = new ConcreteBuilder2(); director.Construct(b1); Product p1 = b1.GetResult(); p1.Show(); director.Construct(b2); Product p2 = b1.GetResult(); p2.Show(); Console.ReadKey(); }
public static void Main() { Director Manuel = new Director(); Builder b1 = new ComprarComida(); Builder b2 = new ComprarJuegos(); Manuel.Construct(b1); Product p1 = b1.GetResult(); p1.ShowP(); Manuel.Construct(b2); Product p2 = b2.GetResult(); p2.ShowJ(); Console.ReadKey(); }
static void Main(string[] args) { Director director = new Director(); IBuilder builder1 = new ConcreteBuilder1(); IBuilder builder2 = new ConcreteBuilder2(); director.Construct(builder1); Product product1 = builder1.GetResult(); product1.Show(); director.Construct(builder2); Product product2 = builder2.GetResult(); product2.Show(); Console.Read(); }
public static void Main() { // Create director and builders Director director = new Director(); Builder b1 = new ConcreteBuilder1(); Builder b2 = new ConcreteBuilder2(); // Construct two products director.Construct(b1); Product p1 = b1.GetResult(); p1.Show(); director.Construct(b2); Product p2 = b2.GetResult(); p2.Show(); // Wait for user Console.Read(); }
static void Main(string[] args) { #region Client Director director = new Director(); IPhoneBuilder phoneBuilder; //Create andriod phoneBuilder = new AndroidPhoneBuilder(); director.Build(phoneBuilder); MobilePhone phone = phoneBuilder.Phone; #endregion }
static void Main(string[] args) { Director director = new Director(); Koffiemachine koffiemachine; koffiemachine = new Espressomachine(); director.MaakKoffie(koffiemachine); Koffie espresso = koffiemachine.GetKoffie(); espresso.Test(); koffiemachine = new Macchiatomachine(); director.MaakKoffie(koffiemachine); Koffie macchiato = koffiemachine.GetKoffie(); macchiato.Test(); koffiemachine = new Ristrettomachine(); director.MaakKoffie(koffiemachine); Koffie ristretto = koffiemachine.GetKoffie(); ristretto.Test(); koffiemachine = new Mochamachine(); director.MaakKoffie(koffiemachine); Koffie mocha = koffiemachine.GetKoffie(); mocha.Test(); koffiemachine = new Irishmachine(); director.MaakKoffie(koffiemachine); Koffie irish = koffiemachine.GetKoffie(); irish.Test(); koffiemachine = new Frappemachine(); director.MaakKoffie(koffiemachine); Koffie frappe = koffiemachine.GetKoffie(); frappe.Test(); koffiemachine = new Lattemachine(); director.MaakKoffie(koffiemachine); Koffie latte = koffiemachine.GetKoffie(); latte.Test(); koffiemachine = new Glacemachine(); director.MaakKoffie(koffiemachine); Koffie glace = koffiemachine.GetKoffie(); glace.Test(); koffiemachine = new Americanomachine(); director.MaakKoffie(koffiemachine); Koffie americano = koffiemachine.GetKoffie(); americano.Test(); koffiemachine = new Cappuccinomachine(); director.MaakKoffie(koffiemachine); Koffie cappuccino = koffiemachine.GetKoffie(); cappuccino.Test(); }
static void Main(string[] args) { Director director = new Director(new LetterToMomBuilder()); Console.WriteLine(director.MakeLetterToMom()); }