Exemplo n.º 1
0
 public HelloWorldController(IHelloWorldService helloWorldService, IRepository <Book> books,
                             IHttpClientFactory httpClientFactory)
 {
     _helloWorldService = helloWorldService;
     _books             = books;
     _httpClientFactory = httpClientFactory;
 }
Exemplo n.º 2
0
        public string GetOrder()
        {
            IHelloWorldService service = _serviceProxy.GetService <IHelloWorldService>(_payload);
            var ret = service.Get();

            return($"get order sucess, User service return: {ret}");
        }
Exemplo n.º 3
0
 // private readonly IBlogService _blogService;
 public HelloWorldController(IHelloWorldService helloWorldService
                             // , IBlogService blogService
                             )
 {
     _helloWorldService = helloWorldService;
     //_blogService = blogService;
 }
Exemplo n.º 4
0
        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();
                }
            }
        }
Exemplo n.º 5
0
        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;
 }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            foreach (var apiType in apiTypes)
            {
                IHelloWorldService apiService = ApiFactory.GetHelloWorldService(apiType);

                apiService.WriteHelloWorld();
            }
        }
Exemplo n.º 8
0
 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));
 })
 {
 }
Exemplo n.º 9
0
 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();
 }
Exemplo n.º 10
0
        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"));
            }
        }
Exemplo n.º 11
0
 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");
 }
Exemplo n.º 12
0
        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();
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 15
0
        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");
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        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}");
        }
Exemplo n.º 18
0
 public MyMvcModel(IHelloWorldService svc)
 {
     Svc = svc;
 }
Exemplo n.º 19
0
 public SomeForm(IHelloWorldService someService)
 {
     //here would be some construction body...
 }
Exemplo n.º 20
0
 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;
 }
Exemplo n.º 23
0
 public IActionResult Index([FromServices] IHelloWorldService helloWorldService)
 {
     ViewData["MyText"] = helloWorldService.SaysHello() + "Jignesh!";
     return(View());
 }
Exemplo n.º 24
0
 public HomeController(ILogger <HomeController> logger, IHelloWorldService helloWorldService)
 {
     _logger            = logger;
     _helloWorldService = helloWorldService;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Constructor with dependency injection
 /// </summary>
 /// <param name="service"></param>
 public HelloWorldApp(IHelloWorldService service)
 {
     _service = service;
 }
Exemplo n.º 26
0
 public ConsoleService(IHelloWorldService helloWorldService)
 {
     HelloWorldService = helloWorldService;
 }
 public DependentController(IHelloWorldService helloWorldService)
 {
     _helloWorldService = helloWorldService;
 }
Exemplo n.º 28
0
 public HelloWorldProxy(IHelloWorldService service)
 {
     _service = service;
 }
Exemplo n.º 29
0
 public HomeController(IHelloWorldService helloWorldService, ILogger <HomeController> logger)
 {
     _helloWorldService = helloWorldService;
     _logger            = logger;
 }
Exemplo n.º 30
0
 public Application(IConfiguration configuration, ILogger <Application> logger, IHelloWorldService helloWorld)
 {
     _configuration = configuration;
     _logger        = logger;
     _helloWorld    = helloWorld;
 }
Exemplo n.º 31
0
 public HelloWorldController(IHelloWorldService helloWorldService)
 {
     _helloWorldService = helloWorldService;
 }
Exemplo n.º 32
0
        public void AfterPropertiesSet(IBeanContextFactory beanContextFactory)
        {
            IHelloWorldService service = ProxyFactory.CreateProxy <IHelloWorldService>();

            beanContextFactory.RegisterExternalBean("client.helloWorldService", service).Autowireable <IHelloWorldService>();
        }
Exemplo n.º 33
0
 public DemoApp(IHelloWorldService helloWorldService)
 {
     _helloWorldService = helloWorldService;
 }
Exemplo n.º 34
0
 public TestController(IHelloWorldService hellowWorldService)
 {
     _helloWorldService = hellowWorldService;
 }