Initial KV API concept

This commit is contained in:
Kruzya
2023-01-05 08:01:18 +03:00
parent a97fac85e4
commit 984e582ce4
8 changed files with 207 additions and 0 deletions
@@ -2,6 +2,7 @@ using System.Threading.Tasks;
using Kruzya.TelegramBot.Core.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Logging;
namespace Kruzya.TelegramBot.Core.Extensions
{
@@ -51,6 +52,9 @@ namespace Kruzya.TelegramBot.Core.Extensions
public static async Task<BotUserValue> FindOrCreateOption(this DbSet<BotUserValue> repository, long chatId,
long userId, string option)
{
repository.GetService<ILogger<Core>>().LogCritical("FindOrCreateOption() is deprecated. " +
"Please, use the new API OptionManagerService.");
var opt = await repository.FindOption(chatId, userId, option);
if (opt == null)
{