kopuo
kopuo
CC#
Created by kopuo on 9/19/2022 in #help
ResponseCache duration in minutes instead seconds
It's a fact, thanks. Another solution that can be used in such a situation is to create a CacheProfile in Program.cs:
builder.Services.AddControllers(options =>
{
options.CacheProfiles.Add("Cache60Mins",
new CacheProfile()
{
Duration = 60 * 60, // minutes * seconds
Location = ResponseCacheLocation.Any
});
});
builder.Services.AddControllers(options =>
{
options.CacheProfiles.Add("Cache60Mins",
new CacheProfile()
{
Duration = 60 * 60, // minutes * seconds
Location = ResponseCacheLocation.Any
});
});
Use:
[ResponseCache(CacheProfile = "Cache60Mins")]
//method
[ResponseCache(CacheProfile = "Cache60Mins")]
//method
This solution is useful when we want to use the settings in minutes from appsettings
13 replies
CC#
Created by kopuo on 8/30/2022 in #help
How to get the date from the database as UTC?
I'm using postgresql with datetime2 column type
8 replies
CC#
Created by kopuo on 8/22/2022 in #help
DbContext.SaveChangesAsync has no effect on the collection of changed objects
Ok, on the List works
8 replies
CC#
Created by kopuo on 8/22/2022 in #help
DbContext.SaveChangesAsync has no effect on the collection of changed objects
Without it, it also does'nt save changes to the database
8 replies