public HelloWorldController(IHelloWorldService helloWorldService, IRepository <Book> books, IHttpClientFactory httpClientFactory) { _helloWorldService = helloWorldService; _books = books; _httpClientFactory = httpClientFactory; }
public string GetOrder() { IHelloWorldService service = _serviceProxy.GetService <IHelloWorldService>(_payload); var ret = service.Get(); return($"get order sucess, User service return: {ret}"); }
// private readonly IBlogService _blogService; public HelloWorldController(IHelloWorldService helloWorldService // , IBlogService blogService ) { _helloWorldService = helloWorldService; //_blogService = blogService; }
static void Main(string[] args) { _container = new Container(); _container.Options.DefaultScopedLifestyle = new LifetimeScopeLifestyle(); _container.Register <IHelloWorldService, HelloWorldService>(Lifestyle.Scoped); SimpleInjectorAccessor.RegisterContainer(_container); SimpleInjectorAccessor.Load(HelloWorldServiceInjector.LoadTypes); _container.Verify(); using (_container.BeginLifetimeScope()) { try { var isCodingExercise = Convert.ToBoolean(ConfigurationSettings.AppSettings["isCodingExercise"]); _helloWorldService = _container.GetInstance <IHelloWorldService>(); var result = _helloWorldService.GetStartMessage(isCodingExercise); Console.WriteLine(result); Console.ReadLine(); } catch (Exception e) { Console.WriteLine("An error occurred."); Console.ReadLine(); } } }
static HelloWorldAgent() { binding = InitializeClientBinding(); _client = new HelloWorldServiceClient(binding, endPoint); }
public HelloWorldController(IHelloWorldService helloWorldService, IGoodbyeWorldService goodbyeWorldService) { _HelloWorldService = helloWorldService; _GoodbyeWorldService = goodbyeWorldService; ClaimsHeaderContext.HeaderInformation.Token = Guid.NewGuid().ToString(); ClaimsHeaderContext.HeaderInformation.AccountId = 23; ClaimsHeaderContext.HeaderInformation.RequestId = 135; }
static void Main(string[] args) { foreach (var apiType in apiTypes) { IHelloWorldService apiService = ApiFactory.GetHelloWorldService(apiType); apiService.WriteHelloWorld(); } }
public HelloWorldBackgroundService(string natsUrl, IHelloWorldService service, ILoggerProvider logger) : base(natsUrl, "helloworldservice", logger, wrapper => { var proxy = new HelloWorldProxy(service); wrapper.RegisterMethod(HelloWorldMethods.SayHello, p => proxy.SayHello(p)); }) { }
public HelloFlow(IHelloWorldService service) { _askForName = new TextInputForm("What's your name?", "Hello there"); _getAnswer = new RemoteActionsCallerForm( x => x.Add(() => _askForName.Introduced, //service param service.SayHello, y => _sayHello.Init(y))); //consume service reply _sayHello = new InformationalMessageForm(); }
private void button1_Click(object sender, EventArgs e) { var factory = new ChannelFactory <IHelloWorldService>("myEndPoint"); IHelloWorldService proxy = factory.CreateChannel(); using (proxy as IDisposable) { MessageBox.Show(proxy.HelloWorld("DynamicProxyClient")); } }
public HelloWorldFlow(IHelloWorldService service) { _askForName = new TextInputForm( "What's your name?", "Hello there", TextType.TreatAsText, "", Validator.IsNotEmptyOrWhitespaceOnly); _getAnswer = new RemoteActionsCallerForm( x => x.Add(() => _askForName.Introduced, //service param service.SayHello, y => _sayHello.Init(y))); //consume service reply _sayHello = new InformationalMessageForm("", "Server reply"); }
private void button1_Click(object sender, EventArgs e) { BasicHttpBinding binding = new BasicHttpBinding(); EndpointAddress address = new EndpointAddress("http://10.17.20.2:8080/HelloWorldService"); ChannelFactory <IHelloWorldService> factory = new ChannelFactory <IHelloWorldService>(binding, address); IHelloWorldService channel = factory.CreateChannel(); label1.Text = channel.SayHello(textBox1.Text); factory.Close(); }
public void T_ClientProxyByGW() { var proxy = SP.GetRequiredService <IApiProxy <IHelloWorldService> >(); proxy.ApiVersion = "1"; proxy.RegisterChtSwaggerDoc(useApiGateway: true); IHelloWorldService helloSvc = proxy.Svc; string id1 = "*abc*"; int id2 = 99; DateTime id3 = DateTime.Today; var postrlt = helloSvc.HelloPost("CCC", "DDD"); print($"API={nameof(IHelloWorldService.HelloPost)} result={postrlt}"); var getrlt = proxy.Svc.HelloGet("EEE", "FFF"); print($"API={nameof(IHelloWorldService.HelloGet)} result={getrlt}"); }
public static IHelloWorldService GetHelloWorldService(string apiType) { IHelloWorldService service = null; switch (apiType) { case "Console": service = new ConsoleProgram(); break; case "Web": service = new HelloWorldController(); break; case "Database": service = new DatabaseProgram(); break; default: throw new ArgumentException("Invalid apiType"); } return(service); }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { ParamChecker.AssertNotNull(ProxyFactory, "ProxyFactory"); // One of maybe hundred models of any type beanContextFactory.RegisterBean <GenericViewModel <TestEntity> >("model_TestEntity_all"); beanContextFactory.RegisterBean <ModelMultiContainer <TestEntity> >("selected_TestEntity_all"); beanContextFactory.RegisterBean <AllTestEntitiesRefresher>("refresher_TestEntity_all"); ViewModelDataChangeController <TestEntity> vmdccTestEntity = (ViewModelDataChangeController <TestEntity>) beanContextFactory.RegisterBean <ViewModelDataChangeController <TestEntity> >("controller_TestEntity_all") .PropertyRefs("refresher_TestEntity_all", "model_TestEntity_all").GetInstance(); vmdccTestEntity.AddRelationPath("Relation"); beanContextFactory.RegisterBean <GenericViewModel <TestEntity2> >("model_TestEntity2_all"); beanContextFactory.RegisterBean <AllTest2EntitiesRefresher>("refresher_TestEntity2_all"); beanContextFactory.RegisterBean <ViewModelDataChangeController <TestEntity2> >("controller_TestEntity2_all") .PropertyRefs("refresher_TestEntity2_all", "model_TestEntity2_all").GetInstance(); IHelloWorldService service = ProxyFactory.CreateProxy <IHelloWorldService>(); beanContextFactory.RegisterExternalBean("client.helloWorldService", service).Autowireable <IHelloWorldService>(); if (!IsNetworkClientMode || !IsHelloWorldBeanActive) { beanContextFactory.RegisterBean <HelloWorldServiceMock>("helloWorldServiceMock"); beanContextFactory.RegisterBean <RandomDataGenerator>("randomDataGenerator").PropertyRefs(CacheNamedBeans.CacheProviderPrototype); } // Data output // beanContextFactory.registerBean<DataProvider>("dataOutput_model_TestEntity_all").propertyRef("Data", "model_TestEntity_all"); // Data input // beanContextFactory.registerBean<DataConsumer>("model_TestEntity_all_2").propertyValue("Token", "myTokenInSharedData"); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHelloWorldService helloWorldService) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => endpoints.MapControllers()); app.UseSwagger(); app.UseSwaggerUI(opt => { opt.SwaggerEndpoint("/swagger/v1/swagger.json", "IisHostService_v1"); opt.RoutePrefix = String.Empty; }); ConfigureMiddleware(app); }
private void CallApi(IApiProxy <IHelloWorldService> proxy) { IHelloWorldService helloSvc = proxy.Svc; string id1 = "*abc*"; int id2 = 99; DateTime id3 = DateTime.Today; var id4 = new HelloInput() { UserName = "******", Date = DateTime.Today }; var rlt = helloSvc.Hello(id1, id2, id3, id4); print($"API={nameof(IHelloWorldService.Hello)} User={rlt.UserName}\nDate={rlt.Date}\n{rlt.Summary}"); var postrlt = helloSvc.HelloPost("CCC", "DDD"); print($"API={nameof(IHelloWorldService.HelloPost)} result={postrlt}"); var getrlt = proxy.Svc.HelloGet("EEE", "FFF"); print($"API={nameof(IHelloWorldService.HelloGet)} result={getrlt}"); }
public MyMvcModel(IHelloWorldService svc) { Svc = svc; }
public SomeForm(IHelloWorldService someService) { //here would be some construction body... }
public SomeFlow(IHelloWorldService helloService, SomeForm someForm) { _someForm = someForm; //here would be rest of constructor code... }
public ValuesController(IHelloWorldService helloWorldService) { _helloWorldService = helloWorldService; }
public HelloWorldApplicationService(IHelloWorldService helloWorldService, IUnitOfWork unitOfWork) : base(unitOfWork) { _helloWorldService = helloWorldService; }
public IActionResult Index([FromServices] IHelloWorldService helloWorldService) { ViewData["MyText"] = helloWorldService.SaysHello() + "Jignesh!"; return(View()); }
public HomeController(ILogger <HomeController> logger, IHelloWorldService helloWorldService) { _logger = logger; _helloWorldService = helloWorldService; }
/// <summary> /// Constructor with dependency injection /// </summary> /// <param name="service"></param> public HelloWorldApp(IHelloWorldService service) { _service = service; }
public ConsoleService(IHelloWorldService helloWorldService) { HelloWorldService = helloWorldService; }
public DependentController(IHelloWorldService helloWorldService) { _helloWorldService = helloWorldService; }
public HelloWorldProxy(IHelloWorldService service) { _service = service; }
public HomeController(IHelloWorldService helloWorldService, ILogger <HomeController> logger) { _helloWorldService = helloWorldService; _logger = logger; }
public Application(IConfiguration configuration, ILogger <Application> logger, IHelloWorldService helloWorld) { _configuration = configuration; _logger = logger; _helloWorld = helloWorld; }
public HelloWorldController(IHelloWorldService helloWorldService) { _helloWorldService = helloWorldService; }
public void AfterPropertiesSet(IBeanContextFactory beanContextFactory) { IHelloWorldService service = ProxyFactory.CreateProxy <IHelloWorldService>(); beanContextFactory.RegisterExternalBean("client.helloWorldService", service).Autowireable <IHelloWorldService>(); }
public DemoApp(IHelloWorldService helloWorldService) { _helloWorldService = helloWorldService; }
public TestController(IHelloWorldService hellowWorldService) { _helloWorldService = hellowWorldService; }