Пример #1
0
        static void Main(string[] args)
        {
            string baseAddress = "net.local://localhost:8080/GetPriceService";

            // Start the service host
            ServiceHost host = new ServiceHost(typeof(GetPrice), new Uri(baseAddress));

            host.AddServiceEndpoint(typeof(IGetPrice), new LocalBinding(), "");
            host.Open();
            Console.WriteLine("In-process service is now running...\n");

            // Start the client
            ChannelFactory <IGetPrice> channelFactory
                = new ChannelFactory <IGetPrice>(new LocalBinding(), baseAddress);
            IGetPrice proxy = channelFactory.CreateChannel();

            // Calling in-process service
            Console.WriteLine("Calling in-process service to get the price of product Id {0}: \n\t {1}"
                              , 101, proxy.GetPriceForProduct(101));
            Console.WriteLine("Calling in-process service to get the price of product Id {0}: \n\t {1}"
                              , 202, proxy.GetPriceForProduct(202));
            Console.WriteLine("Calling in-process service to get the price of product Id {0}: \n\t {1}"
                              , 303, proxy.GetPriceForProduct(303));

            Console.WriteLine("\nPress <ENTER> to terminate...");
            Console.ReadLine();
        }
Пример #2
0
 public CreateInvoice(ICustomerManager getCustomers, IGetUsedServices getUsedServices, IGetPrice getPrice, IPreview preview)
 {
     _getCustomers    = getCustomers;
     _getUsedServices = getUsedServices;
     _getPrice        = getPrice;
     _preview         = preview;
 }