using System; using Cysharp.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace BITKit; public interface IDatabaseContext where T : class { void Add(T entity); UniTask AddAsync(T entity); void Remove(T entity); T[] GetArray(); bool TrySearch(Func searchFactory, out T result); bool TrySearchArray(Func searchFactory, out T[] result); } public abstract class EntityFrameworkContext:DbContext ,IDatabaseContext where T : class { protected DbSet context { get; private set; } public void Add(T entity) { context.Add(entity); SaveChanges(); } public async UniTask AddAsync(T entity) { await context.AddAsync(entity); await SaveChangesAsync(); } public void Remove(T entity) { throw new NotImplementedException(); } public T[] GetArray() { throw new NotImplementedException(); } public bool TrySearch(Func searchFactory, out T result) { throw new NotImplementedException(); } public bool TrySearchArray(Func searchFactory, out T[] result) { throw new NotImplementedException(); } }