2023-09-15 20:19:44 +00:00
|
|
|
using BotSharp.Abstraction.Agents.Enums;
|
2023-09-07 22:04:34 +00:00
|
|
|
using BotSharp.Abstraction.Agents.Models;
|
2023-08-26 04:41:01 +00:00
|
|
|
using BotSharp.Abstraction.Repositories;
|
2023-09-07 22:04:34 +00:00
|
|
|
using BotSharp.Abstraction.Routing.Models;
|
|
|
|
|
using BotSharp.Abstraction.Users.Models;
|
2023-08-10 04:53:22 +00:00
|
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
|
|
|
|
2023-06-11 23:46:02 +00:00
|
|
|
namespace BotSharp.Core.Repository;
|
|
|
|
|
|
2023-08-10 04:53:22 +00:00
|
|
|
public class BotSharpDbContext : Database, IBotSharpRepository
|
2023-06-11 23:46:02 +00:00
|
|
|
{
|
2023-09-07 22:04:34 +00:00
|
|
|
public IQueryable<User> Users => throw new NotImplementedException();
|
2023-08-10 04:53:22 +00:00
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public IQueryable<Agent> Agents => throw new NotImplementedException();
|
2023-09-02 05:10:46 +00:00
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public IQueryable<UserAgent> UserAgents => throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
|
public IQueryable<Conversation> Conversations => throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
|
public IQueryable<RoutingItem> RoutingItems => throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
|
public IQueryable<RoutingProfile> RoutingProfiles => throw new NotImplementedException();
|
2023-09-02 05:10:46 +00:00
|
|
|
|
|
|
|
|
|
2023-08-10 04:53:22 +00:00
|
|
|
public int Transaction<TTableInterface>(Action action)
|
|
|
|
|
{
|
|
|
|
|
DatabaseFacade database = base.GetMaster(typeof(TTableInterface)).Database;
|
|
|
|
|
int num = 0;
|
|
|
|
|
if (database.CurrentTransaction == null)
|
|
|
|
|
{
|
|
|
|
|
using (Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction dbContextTransaction = database.BeginTransaction())
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
action();
|
|
|
|
|
num = base.SaveChanges();
|
|
|
|
|
dbContextTransaction.Commit();
|
|
|
|
|
return num;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
dbContextTransaction.Rollback();
|
|
|
|
|
if (ex.Message.Contains("See the inner exception for details"))
|
|
|
|
|
{
|
|
|
|
|
throw ex.InnerException;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
action();
|
|
|
|
|
return base.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex2)
|
|
|
|
|
{
|
|
|
|
|
if (database.CurrentTransaction != null)
|
|
|
|
|
{
|
|
|
|
|
database.CurrentTransaction.Rollback();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ex2.Message.Contains("See the inner exception for details"))
|
|
|
|
|
{
|
|
|
|
|
throw ex2.InnerException;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw ex2;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-09-03 04:11:53 +00:00
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
public void CreateNewConversation(Conversation conversation)
|
2023-09-03 04:11:53 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public List<RoutingItem> CreateRoutingItems(List<RoutingItem> routingItems)
|
2023-09-03 04:11:53 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public List<RoutingProfile> CreateRoutingProfiles(List<RoutingProfile> profiles)
|
2023-09-03 04:11:53 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public void CreateUser(User user)
|
2023-09-03 04:11:53 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2023-09-03 04:54:22 +00:00
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public void DeleteRoutingItems()
|
2023-09-03 04:54:22 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2023-09-03 19:32:12 +00:00
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public void DeleteRoutingProfiles()
|
2023-09-03 19:32:12 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2023-09-03 22:43:50 +00:00
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public Agent GetAgent(string agentId)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-09 20:13:19 +00:00
|
|
|
public List<string> GetAgentResponses(string agentId, string prefix, string intent)
|
2023-09-07 22:04:34 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Conversation GetConversation(string conversationId)
|
2023-09-03 22:43:50 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetConversationDialog(string conversationId)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public List<Conversation> GetConversations(string userId)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-09 21:44:25 +00:00
|
|
|
public List<StateKeyValue> GetConversationStates(string conversationId)
|
2023-09-03 22:43:50 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public User GetUserByEmail(string email)
|
2023-09-03 22:43:50 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-15 20:19:44 +00:00
|
|
|
public void UpdateAgent(Agent agent, AgentField field)
|
2023-09-03 22:43:50 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-07 22:04:34 +00:00
|
|
|
public void UpdateConversationDialog(string conversationId, string dialogs)
|
2023-09-03 22:43:50 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-09 21:44:25 +00:00
|
|
|
public void UpdateConversationStates(string conversationId, List<StateKeyValue> states)
|
2023-09-03 22:43:50 +00:00
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2023-09-12 22:08:58 +00:00
|
|
|
|
|
|
|
|
public string GetAgentTemplate(string agentId, string templateName)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2023-06-11 23:46:02 +00:00
|
|
|
}
|