Skip to content

Instantly share code, notes, and snippets.

{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"RedisSettings": {
public void ConfigureServices(IServiceCollection services)
{
var settings = configuration.GetSection(SectionNames.RedisSettings).Get<RedisSettings>();
services.AddDistributedRedisCache(option =>
{
option.Configuration = settings.Uri;
option.InstanceName = settings.Instance;
});
}
private IConfiguration Configuration { get; }
private readonly ILogger<CachingService> logger;
public CachingService(IConfiguration configuration,ILogger<CachingService> logger)
{
Configuration = configuration;
this.logger = logger;
}
private RedisCacheProviderStatus ServiceStatus()
public async Task<IEnumerable<Sample>> GetAll()
{
if (cachingService.Exists(CacheKey.Samples))
{
return cachingService.Get<IEnumerable<Sample>>(CacheKey.Samples);
}
var list = await repository.GetAllAsync();
cachingService.Set(CacheKey.Samples, samples.ToList());
[
{
"outputFileName": "wwwroot/bundles/css/main.css",
"inputFiles": [
"wwwroot/lib/bootstrap/dist/css/bootstrap.css",
"wwwroot/css/site.css",
"wwwroot/lib/sweetalert/sweetalert2.css",
"wwwroot/lib/datatables/datatables.css"
]
},
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddSwaggerGen();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseSwagger();
app.UseSwaggerUI(c =>
{
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"WebApi": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "WebApiSwagger",
Description = "Sample ASP.NET Core Web API Swagger implementation",
Contact = new OpenApiContact
{
Name = "Umay ERAS",
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "Web Api Swagger",
Description = "Sample ASP.NET Core Web API Swagger implementation",
Contact = new OpenApiContact
{
Name = "Umay ERAS",