public async Task <ActionResult> TestMyDependency() { var r = await _myDependency.WriteMessage( "WindsorContainerTestController.TestMyDependency created this message."); return(Json(r)); }
// GET: /mydependency/ public async Task <IActionResult> Index() { await _myDependency.WriteMessage( "MyDependencyController.Index created this message."); return(View()); }
public ContentResult OnGet() { _myDependency.WriteMessage("Test26Model created this message."); return(Content($"Title: {_options.Title} \n" + $"Name: {_options.Name} \n" + $"Foreground: {_color_options.Foreground} \n" + $"Background: {_color_options.Background}")); }
public IActionResult Write() { var message = $"GUID: {Guid.NewGuid()}"; _dependency.WriteMessage(message); return(Ok()); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { _myDependency.WriteMessage("Teste de injeção de pendencia."); _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); await Task.Delay(1000, stoppingToken); } }
public IEnumerable <WeatherForecast> Get() { _myDependency.WriteMessage("inside the weather controller get"); var rng = new Random(); return(Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateTime.Now.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }) .ToArray()); }
public async Task <IActionResult> Index() { _logger.LogInformation("\n"); _logger.LogInformation("==============================================================================================="); _logger.LogInformation($"{nameof(TransientOperation)} Guid:{TransientOperation.OperationId}"); _logger.LogInformation($"{nameof(ScopedOperation)} Guid:{ScopedOperation.OperationId}"); _logger.LogInformation($"{nameof(SingletonOperation)} Guid:{SingletonOperation.OperationId}"); _logger.LogInformation($"{nameof(SingletonInstanceOperation)} Guid:{SingletonInstanceOperation.OperationId}"); _logger.LogInformation("==============================================================================================="); _logger.LogInformation("\n"); await _myDependency.WriteMessage("调用信息"); return(View()); }
public async Task <IActionResult> Index() { await _myDependency.WriteMessage("HomeController.Index created this message."); _logger.LogInformation("No, I don't have scope"); using (_logger.BeginScope("Scope value")) using (_logger.BeginScope(new Dictionary <string, object> { { "CustomValue1", 12345 } })) { _logger.LogInformation("Yes, I have the scope"); _logger.LogInformation("Yes, I still have the scope"); } _logger.LogInformation("No, I lost it again"); return(View()); }
public CarsController(ElecCarContext context, IMyDependency myDependency, IConfiguration config) { configuration = config; _myDependency = myDependency; _db = context; myDependency.WriteMessage("shdfghsdgf"); if (context.Cars.Count() == 0) { foreach (var b in DataSource.GetCars()) { context.Cars.Add(b); // context.Manufacturers.Add(b.Manufacturer); } context.SaveChanges(); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IConfiguration config, IInjected injected, IMyDependency myDependency) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await myDependency.WriteMessage("Inject---"); await context.Response.WriteAsync("Hello World!"); }); }); }
public TodoController(TodoContext context, IMyDependency myDependency) { _context = context; //EFLogging Extend--1 _context.ConfigureLogging(s => Console.WriteLine(s)); if (_context.TodoItems.Count() == 0) { // Create a new TodoItem if collection is empty, // which means you can't delete all TodoItems. _context.TodoItems.Add(new TodoItem { Name = "Item1" }); _context.SaveChanges(); } _myDependency = myDependency; _myDependency.WriteMessage("Dependency_Injection by Constructure"); }
public void OnGet() { _myDependency.WriteMessage("AddMyDependencyInjectionModel.OnGet"); }
public IActionResult SyncGet() { _myDependency.WriteMessage("test"); return(Ok()); }
public void message() { _myDependency.WriteMessage("Index2Model.OnGet"); }
public async Task OnGetAsync() { await _myDependency.WriteMessage( "IndexModel.OnGetAsync created this message."); }
public void ConsumeThings() { //DoSomething _dependency.WriteMessage("Learning In Urdu!"); _emailSender.SendEmail(); }
public async Task <IActionResult> Index() { await _myDependency.WriteMessage("IndexModel.OnGetAsync created this message."); return(View()); }
public void OnGet() { _myDependency.WriteMessage("IndexModel.OnGetAsync"); }