/// <summary> /// Entry point into console application. /// </summary> static void Main() { // Create RefinedAbstraction Customers customers = new Customers("Chicago"); // Set ConcreteImplementor customers.Data = new CustomersData(); // Exercise the bridge customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.Add("Mikhail Jacques"); customers.Next(); customers.Show(); customers.Add("Tom Jerry"); customers.ShowAll(); // Wait for user Console.ReadKey(); }
public static void Run() { Console.WriteLine("This real-world code demonstrates the Bridge pattern in which a BusinessObject abstraction is decoupled from the implementation in DataObject. The DataObject implementations can evolve dynamically without changing any clients."); Customers customers = new Customers("Chicago"); customers.Data = new CustomersData(); customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.ShowAll(); /* * Jim Jones * Samual Jackson * Allen Good * * ------------------------ * Customer Group: Chicago * Jim Jones * Samual Jackson * Allen Good * Ann Stills * Lisa Giolani * Henry Velasquez * ------------------------ */ }
static void Main() { // Create RefinedAbstraction Customers customers = new Customers("Chicago"); // Set ConcreteImplementor customers.Data = new CustomersData(); // Exercise the bridge customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.ShowAll(); }
/// <summary> /// The test bridge two. /// </summary> private static void TestBridgeTwo() { // Create RefinedAbstraction Customers customers = new Customers("Chicago"); // Set ConcreteImplementor customers.Data = new CustomersData(); // Exercise the bridge customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.ShowAll(); // Wait for user Console.ReadKey(); }
/// <summary> /// BRIDGE /// Decouple an abstraction from its implementation so that the two can vary independently. /// </summary> /// <param name="args"></param> static void Main(string[] args) { //Customers customers = new Customers("Chicago"); //customers.Data = new CustomersData(); Customers customers = new Customers("Chicago") { Data = new CustomersData() }; customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.ShowAll(); Console.ReadKey(); }
static void Main(string[] args) { Customers customers = new Customers("Chicago"); // Set ConcreteImplementor customers.Data = new CustomersData(); // Exercise the bridge customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.ShowAll(); // Wait for user Console.ReadKey(); }
//Desacoplar uma abstração de sua implementação // para que as duas possam variar independentemente. static void Main(string[] args) { //Esse código do mundo real demonstra o padrão Bridge no qual //uma abstração do BusinessObject é dissociada da implementação no DataObject. //As implementações do DataObject podem evoluir dinamicamente sem alterar nenhum cliente. Customers customers = new Customers("Chicago"); // Set ConcreteImplementor customers.Data = new CustomersData(); // Exercise the bridge customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.ShowAll(); }
static void Main(string[] args) { Customers customers = new Customers("Chicago"); // Establecer Implementador de Concreto customers.Data = new CustomersData(); // ejercitar el puente customers.Show(); customers.Next(); customers.Show(); customers.Next(); customers.Show(); customers.Add("Henry Velasquez"); customers.ShowAll(); //Esperando el usuario Console.ReadKey(); }