Skip to content

Instantly share code, notes, and snippets.

@DocGreenRob
Created September 24, 2021 18:16
Show Gist options
  • Save DocGreenRob/c0531afd4a3377b07d690fe23fb4df65 to your computer and use it in GitHub Desktop.
Save DocGreenRob/c0531afd4a3377b07d690fe23fb4df65 to your computer and use it in GitHub Desktop.
BaseController Example
using Cge.Core.Extensions;
using Cge.Core.Logging;
using Cge.Core.Models;
using HomeaZZon.Common.Dto;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Primitives;
namespace HomeaZZon.Api.Controllers
{
public abstract class BaseController : ControllerBase
{
public BaseController(ITelemetryClient telemetryClient, IConfiguration configuration, IApplicationContext applicationContext)
{
TelemetryClient = telemetryClient.ValidateArgNotNull(nameof(telemetryClient));
Configuration = configuration.ValidateArgNotNull(nameof(configuration));
ApplicationContext = applicationContext.ValidateArgNotNull(nameof(applicationContext));
}
public IApplicationContext ApplicationContext { get; }
public IConfiguration Configuration { get; }
public ITelemetryClient TelemetryClient { get; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment