public void Main() { Director director = new Director(); Console.WriteLine("Cadena de conexión del SQL Server"); SQLServerBuilder CadenaBuilder = new SQLServerBuilder(); director.CrearConexion(CadenaBuilder); SQLServer sQLServer = CadenaBuilder.GetResult(); sQLServer.Imprimir(); Console.WriteLine("\nCadena de conexión del MySQL "); MySQLBuilder CadenaMySQLBuilder = new MySQLBuilder(); director.CrearConexion(CadenaMySQLBuilder); MySQL mySQL = CadenaMySQLBuilder.GetResult(); mySQL.Imprimir(); Console.WriteLine("\n Cadena de conexión del Access"); AccessBuilder CadenaAccessBuilder = new AccessBuilder(); director.CrearConexion(CadenaAccessBuilder); Access Access = CadenaAccessBuilder.GetResult(); Access.Imprimir(); Console.ReadLine(); }
static void Main(string[] args) { var director = new Director(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("********************************************"); Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("Elige la cadena que desea generar: "); Console.WriteLine("1 - Access"); Console.WriteLine("2 - MySQL"); Console.WriteLine("3 - SQL"); Console.ResetColor(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("********************************************"); Console.ResetColor(); int iTipoCadena = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Crear Conexión:"); switch (iTipoCadena) { case 1: AccessBuilder accessBuilder = new AccessBuilder(); director.Builder = accessBuilder; director.AccessConection(); Console.WriteLine(accessBuilder.GetResult().ConnectionString()); break; case 2: MySQLBuilder mySQLBuilder = new MySQLBuilder(); director.Builder = mySQLBuilder; director.MySQLConection(); Console.WriteLine(mySQLBuilder.GetResult().ConnectionString()); break; case 3: SQLBuilder sqlBuilder = new SQLBuilder(); director.Builder = sqlBuilder; director.SQLConection(); Console.WriteLine(sqlBuilder.GetResult().ConnectionString()); break; } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("\r\nPresione una tecla para salir."); Console.ReadKey(); }