Esempio n. 1
0
        public async Task <bool> EnviarAsync([FromBody] Doble doble)
        {
            string connectionString = "Endpoint=sb://qimpar1.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=B8AJ5zfVsOdJ+5bl9wIn2WZSjOGFtnHMeipdkqcbHoI=";
            string queueName        = "qImpar1";
            string mensaje          = JsonConvert.SerializeObject(doble);

            // create a Service Bus client
            await using (ServiceBusClient client = new ServiceBusClient(connectionString))
            {
                // create a sender for the queue
                ServiceBusSender sender = client.CreateSender(queueName);

                // create a message that we can send
                ServiceBusMessage message = new ServiceBusMessage(mensaje);

                // send the message
                await sender.SendMessageAsync(message);

                Console.WriteLine($"Sent a single message to the queue: {queueName}");
            }

            return(true);
        }
Esempio n. 2
0
        public static void Probar()
        {
            Console.Clear();

            IMostrador a = new MostrarNormal();

            a = new ExcluirDinamico(c => c.Telefono > 456_7892, a);
            a = new Doble(a); // probar eliminar

            IMostrador b = new MostrarInvertido();

            b = new ExcluirFijo(b, "Alejandro");

            IMostrador d = new Decidir(c => c.Telefono > 456_7892, a, b);

            Componer c = new Componer();

            c.Agregar(a);
            c.Agregar(b);

            var agenda = new Agenda();

            agenda.Agregar(new("Alejandro", 456_7890) );
            agenda.Agregar(new("Alvaro", 456_7891) );
            agenda.Agregar(new("Franco", 456_7892) );
            agenda.Agregar(new("Hugo", 456_7893) );
            agenda.Agregar(new("Nahuel", 456_7894) );

            Console.Clear();
            Console.WriteLine("Demo Open/Close (Usando Interface con Decorador)");

            Console.WriteLine("\nEjemplo 1");
            agenda.Listar(d);

            Console.WriteLine("\nEjemplo 2");
            agenda.Listar(c);
        }