static async Task Main(string[] args) { AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true); var serverAddress = "http://localhost:8099";//docker hosted url // var serverAddress = "http://localhost:32812";//docker hosted url var httpHandler = new HttpClientHandler(); // Return `true` to allow certificates that are untrusted/invalid //httpHandler.ServerCertificateCustomValidationCallback = // HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; using var channel = GrpcChannel.ForAddress(serverAddress); //using var channel = GrpcChannel.ForAddress(serverAddress,new GrpcChannelOptions { HttpHandler= httpHandler }); var client = new SampleService.SampleServiceClient(channel); // unary var reply = await client.LoadDetailsAsync( new RequestDetails() { Address = "", Email = "", EmployeeName = "", Phone = 0, Status = false }); Console.WriteLine("Name: " + reply.EmployeeName); Console.WriteLine("Address: " + reply.Address); Console.WriteLine("Phone: " + reply.Phone); Console.WriteLine("Email: " + reply.Email); Console.WriteLine("Status: " + reply.Status); Console.WriteLine(); Console.WriteLine("Stream object"); Console.WriteLine(); }
/// <summary> /// Loads a company by its id /// </summary> /// <param name="businessEntityId">The unique identifier for the company.</param> /// <returns></returns> public Company LoadCompany(long businessEntityId) { Company result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadCompany(businessEntityId); } return result; }
/// <summary> /// Loads a company by the email address of one of its contacts. /// </summary> /// <param name="email">the email address of the contact person.</param> /// <returns>A List of companies</returns> public List<Company> LoadCompanyByContactEmail(string email) { List<Company> result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadCompanyByContactEmail(email); } return result; }
/// <summary> /// Loads one or more companies by its name. /// </summary> /// <param name="name">The name of the company to be loaded.</param> /// <returns>A list of compnaies</returns> public List<ContactPerson> LoadContactsByCompany(Company company) { List<ContactPerson> result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadContactsByCompany(company); } return result; }
/// <summary> /// Loads a company by the email address of one of its contacts. /// </summary> /// <param name="email">the email address of the contact person.</param> /// <returns>A List of companies</returns> public List <Company> LoadCompanyByContactEmail(string email) { List <Company> result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadCompanyByContactEmail(email); } return(result); }
/// <summary> /// Loads a company by its id /// </summary> /// <param name="businessEntityId">The unique identifier for the company.</param> /// <returns></returns> public Company LoadCompany(long businessEntityId) { Company result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadCompany(businessEntityId); } return(result); }
/// <summary> /// Loads one or more companies by its name. /// </summary> /// <param name="name">The name of the company to be loaded.</param> /// <returns>A list of compnaies</returns> public List <ContactPerson> LoadContactsByCompany(Company company) { List <ContactPerson> result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadContactsByCompany(company); } return(result); }
/// <summary> /// Loads one or more companies by its name. /// </summary> /// <param name="name">The name of the company to be loaded.</param> /// <returns>A list of compnaies</returns> public List <Company> LoadCompanyByName(string name) { List <Company> result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadCompanyByName(name); } return(result); }
/// <summary> /// Loads one or more companies by its name. /// </summary> /// <param name="name">The name of the company to be loaded.</param> /// <returns>A list of compnaies</returns> public List<Company> LoadCompanyByName(string name) { List<Company> result = null; using (var service = new SampleService.SampleServiceClient()) { result = service.LoadCompanyByName(name); } return result; }
/// <summary> /// Loads the image data for a Product /// </summary> /// <param name="productId"></param> /// <returns></returns> public List <ProductPhoto> GetProductPhoto(string productId) { var result = new List <ProductPhoto>(); using (var service = new SampleService.SampleServiceClient()) { var photos = service.GetProductPhoto(productId); foreach (var photo in photos) { result.Add(ReadPhoto(photo)); } } return(result); }
/// <summary> /// Loads Product informations for a company /// </summary> /// <param name="company"></param> /// <returns></returns> public List<BikeProduct> LoadProductByCompany(Company company) { List<BikeProduct> result = new List<BikeProduct>(); using (var service = new SampleService.SampleServiceClient()) { List<Product> response = service.LoadProductByCompany(company); response.ForEach(x => { var bike = new BikeProduct() { Id = x.Id, Name = x.Name, InstallationDate = x.InstallationDate, }; ConvertPropertyBag(x, bike); result.Add(bike); }); } return result; }
/// <summary> /// Loads Product informations for a company /// </summary> /// <param name="company"></param> /// <returns></returns> public List <BikeProduct> LoadProductByCompany(Company company) { List <BikeProduct> result = new List <BikeProduct>(); using (var service = new SampleService.SampleServiceClient()) { List <Product> response = service.LoadProductByCompany(company); response.ForEach(x => { var bike = new BikeProduct() { Id = x.Id, Name = x.Name, InstallationDate = x.InstallationDate, }; ConvertPropertyBag(x, bike); result.Add(bike); }); } return(result); }
/// <summary> /// Loads the image data for a Product /// </summary> /// <param name="productId"></param> /// <returns></returns> public List<ProductPhoto> GetProductPhoto(string productId) { var result = new List<ProductPhoto>(); using (var service = new SampleService.SampleServiceClient()) { var photos = service.GetProductPhoto(productId); foreach (var photo in photos) { result.Add(ReadPhoto(photo)); } } return result; }