Example #1
0
        static void Main(string[] args)
        {
            string path = @".\private$\XactQueue4Demo";

            if (!MessageQueue.Exists(path))
            {
                MessageQueue.Create(path, true);
            }
            var queue = new MessageQueue(path);

            queue.Purge();

            using (ChannelFactory <IGreeting> channelFactoryHello = new ChannelFactory <IGreeting>("greetingService"))
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    IGreeting proxy = channelFactoryHello.CreateChannel();
                    proxy.SayHello("Foo");
                    proxy.SayGoodbye("Bar");
                    (proxy as ICommunicationObject).Close();
                    scope.Complete();
                }
            }
            var message = queue.Receive();

            byte[] buffer = new byte[message.BodyStream.Length];
            message.BodyStream.Read(buffer, 0, buffer.Length);
            Console.WriteLine(Encoding.Default.GetString(buffer));
        }
    public string SayHello(string strLanguage)
    {
        var language = languageFactory.Create(strLanguage);

        greeting = greetingFactory.Create(language);
        return(greeting.SayHello());
    }
Example #3
0
 public TeachersController(IEmail emailObj, SchoolContext dbContext, Student_BAL balObj, IGreeting greetObj, IGreeting greetObj1)
 {
     this.emailObj  = emailObj;
     this.db        = dbContext;
     this.balObj    = balObj;
     this.greetObj  = greetObj;
     this.greetObj1 = greetObj1;
 }
Example #4
0
 public RootLuisDialog()
 {
     _greeting = new GreetingService();
     _help     = new HelpService();
     _actions  = new List <IAction> {
         new FacturaService(), new ContratoService(), new ConsumoService()
     };
 }
 public WeatherForecastController(ILogger <WeatherForecastController> logger,
                                  IGreeting saludos, IGreeting <EnglishGreetings> greeting, IWeatherManager weatherManager)
 {
     _logger         = logger;
     _saludos        = saludos;
     _greetings      = greeting;
     _weatherManager = weatherManager;
 }
Example #6
0
 static void Main(string[] args)
 {
     IGreeting[] greetings = new IGreeting[3] {
         new French(), new English(), new Spanish()
     };
     foreach (IGreeting g in greetings)
     {
         Console.Write(g.Greeting + " ");
     }
 }
Example #7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greeting)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseFileServer();

            app.UseMvc(ConfigureRoute);
        }
Example #8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greetings)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Run(async(context) =>
            {
                await context.Response.WriteAsync(greetings.GetMessageOfDay());
            });
        }
Example #9
0
 public IHttpActionResult Put(IGreeting greeting)
 {
     //Implementation of Put Request
     try
     {
         return(Ok());
     }
     catch (Exception e)
     {
         return(Json(e.Message + " " + e.InnerException));
     }
 }
Example #10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greeting, ILogger <Startup> logger)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }


            app.Run(async(context) =>
            {
                var greetings = greeting.GreetingOfTheDay();
                await context.Response.WriteAsync($"{greetings}" + $"{env.EnvironmentName}");
            });
        }
Example #11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greet, ILogger <Startup> logger)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRewriter(new RewriteOptions().AddRedirectToHttpsPermanent());
            app.UseStaticFiles();
            app.UseNodeModules(env.ContentRootPath);
            //app.UseMvcWithDefaultRoute();
            app.UseAuthentication();

            app.UseMvc(ConfigureRoute);



            app.Use(next =>
            {
                return(async context =>
                {
                    if (context.Request.Path.StartsWithSegments("/mym"))
                    {
                        logger.LogInformation("Inside the request");
                        await context.Response.WriteAsync("Hit My Middle Ware");
                        logger.LogInformation("Request handled");
                    }
                    else
                    {
                        logger.LogInformation("Request forwarded");
                        await next(context);
                    }
                });
            });

            app.UseWelcomePage(new WelcomePageOptions
            {
                Path = "/wp"
            }
                               );

            //app.Run(async (context) =>
            //{

            //    string setting = greet.GetMessage();
            //    //await context.Response.WriteAsync($"{setting} : {env.EnvironmentName}");
            //    context.Response.ContentType = "text/plain";
            //    await context.Response.WriteAsync($"Not Found");
            //});
        }
Example #12
0
 static void Main(string[] args)
 {
     using (ChannelFactory <IGreeting> channelFactoryHello = new ChannelFactory <IGreeting>("greetingService"))
     {
         using (TransactionScope scope = new TransactionScope())
         {
             IGreeting proxy = channelFactoryHello.CreateChannel();
             proxy.SayHello("Foo");
             proxy.SayGoodbye("Bar");
             (proxy as ICommunicationObject).Close();
             scope.Complete();
         }
     }
 }
Example #13
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              IConfiguration configuration,
                              IGreeting greeting,
                              ILogger <Startup> logger
                              )
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //app.Use(next =>
            //{
            //    return async context =>
            //    {
            //        logger.LogInformation("Request Coming!!!");
            //        if (context.Request.Path.StartsWithSegments("/mym"))
            //        {
            //            await context.Response.WriteAsync("Hit!!!");
            //            logger.LogInformation("Request handled");
            //        }
            //        else
            //        {
            //            await next(context);
            //            logger.LogInformation("Request outgoing");
            //        }
            //    };
            //});
            //app.UseDefaultFiles();
            app.UseStaticFiles();
            //The Line below is an alterntaive to having "app.UseDefaultFiles(); app.UseStaticFiles();"
            app.UseMvc(ConfigureRoutes);
            //app.UseFileServer();
            app.UseWelcomePage(new WelcomePageOptions()
            {
                Path = "/wp"
            });
            app.Run(async(context) =>
            {
                // throw new Exception("Exception instead of greetings");
                //var greeting = config["Greeting"];
                // var message = greeting.GetMessageOfTheDay();
                var message = configuration["Greeting"];
                await context.Response.WriteAsync($"Not Found");
            });
        }
Example #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IGreeting greeting)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles();

            app.UseMvc(GetConfigureRoutes);

            app.Run(async(context) =>
            {
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync($"Not found");
            });
        }
Example #15
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting config, ILogger <Startup> logger)
        {
            var greeting = config.getGreetings();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }
            //app.Use(next =>
            //{
            //    return async context => {
            //       await context.Response.WriteAsync("HIT!!");
            //    };

            //    //return async context =>
            //    //{
            //    //    logger.LogInformation("Request Started");
            //    //    if(context.Request.Path.StartsWithSegments("/mym"))
            //    //    {
            //    //        await context.Response.WriteAsync("HIT!!");
            //    //        logger.LogInformation("Request handled..");
            //    //    }
            //    //    else
            //    //    {
            //    //        await next(context);
            //    //        logger.LogInformation("Request outgoing..");
            //    //    }
            //    //};
            //});
            //app.UseDefaultFiles();
            //app.UseStaticFiles();
            app.UseMvc(configureRoutes);
            //app.UseWelcomePage(new WelcomePageOptions {
            //    Path = "/wp"
            //});

            app.Run(async(context) =>
            {
                //throw new Exception();
                await context.Response.WriteAsync($"{greeting} and {env.EnvironmentName} ");
            });
        }
Example #16
0
 public IHttpActionResult Get(int id)
 {
     //Implementation of Get By Id
     try
     {
         GreetingService greetingService = new GreetingService();
         IGreeting       greeting        = greetingService.Fetch(id);
         if (greeting != null)
         {
             return(Ok(greeting));
         }
         else
         {
             return(NotFound());
         }
     }
     catch (Exception e)
     {
         return(Json(e.Message + " " + e.InnerException));
     }
 }
Example #17
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greeting, ILogger <Startuppa> logger, IConfiguration conf)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            /*app.Use(next =>
             * {
             * logger.LogInformation("Use Called");
             *  return async context =>
             *  {
             *      logger.LogInformation("Request incoming" + DateTime.Now);
             *      if (context.Request.Path.StartsWithSegments("/mym"))
             *      {
             *          await context.Response.WriteAsync("Hit!!");
             *          logger.LogInformation("Request Handled");
             *      }
             *      else
             *      {
             *          await next(context);
             *          logger.LogInformation("Response Incoming");
             *      }
             *  };
             * });
             */

            app.UseMvc(configureRoutes);

            app.UseWelcomePage(new WelcomePageOptions {
                Path = "/wp"
            });

            app.Run(async(context) =>
            {
                String message = greeting.getGreting();
                message        = conf["Greeting"];
                await context.Response.WriteAsync($"Not Found");
            });
        }
Example #18
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            IGreeting greeting)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Example #19
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greeting)
        {
            _container.AutoCrossWireAspNetComponents(app);
            _container.RegisterMvcControllers(app);
            Bootstrapper.InitializeContainer(this._container);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }



            app.UseStaticFiles();
            app.UseMvc(routeBuilder => routeBuilder.MapRoute("Default", "{controller=Home}/{action=Index}"));

//            app.Use(next =>
//            {
//                return async context =>
//                {
//                    if (context.Request.Path.StartsWithSegments("/wtf"))
//                    {
//                        await context.Response.WriteAsync("WTF Bro!!");
//                    }
//                    else
//                    {
//                        await next(context);
//                    }
//                };
//            });

//            app.Run(async (context) =>
//            {
//                await context.Response.WriteAsync(greeting.GetGreeting());
//
//            });
        }
Example #20
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IGreeting greetings, ILogger <Startup> logger)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.Use(next =>
            {
                return(async context =>
                {
                    logger.Log(LogLevel.Information, "Entrada");
                    if (context.Request.Path.StartsWithSegments("/log"))
                    {
                        await context.Response.WriteAsync("Hit!!");
                        logger.LogInformation("Requisição tradada");
                    }
                    else
                    {
                        await next(context);
                        logger.LogInformation("Requisição invalida");
                    }
                });
            });

            app.UseWelcomePage("/bemvindo");

            app.UseMvc(ConfigurationRountes);

            app.Run(async(context) =>
            {
                var messageOfDay             = greetings.GetMessageOfDay();
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync(messageOfDay);
            });
        }
Example #21
0
 public HomeController(IRestaurant objRes, IGreeting greeting)
 {
     restaurant = objRes;
     greet      = greeting;
 }
Example #22
0
 public Client(IGreeting greetingStrategy)
 {
     this.greetingStrategy = greetingStrategy;
 }
Example #23
0
        public string SayHello()
        {
            IGreeting greeting = Activator.CreateInstance <T>();

            return(greeting.Text);
        }
Example #24
0
 public Client(IGreeting greetingStrategy)
 {
     this.greetingStrategy = greetingStrategy;
 }
Example #25
0
 public void Insert(IGreeting greeting)
 {
     //Implementation of Insert
 }
Example #26
0
 public static void Greet(IGreeting greeting)
 {
     Console.WriteLine(greeting.Message);
 }
Example #27
0
 public HomeController(IRestaurantData restaurantData, IGreeting greeting)
 {
     _restaurantData = restaurantData;
     _greeting       = greeting;
 }
 public HomeController(IRestaurantData restaurantDataService, IGreeting greetingService)
 {
     _restaurantDataService = restaurantDataService;
     _greetingService       = greetingService;
 }
 public void MakeGreeting(string name, IGreeting greeting)
 {
     greeting.GreetingPeople(name);
 }
Example #30
0
 public HomeController(IRestaurantData rd, IGreeting gr)
 {
     restaurantDataSource = rd;
     greeting             = gr;
 }
Example #31
0
 public void Update(IGreeting greeting)
 {
     //Implementation of Update
 }