dotnet-data/PoweredSoft.Data.Core/IDbContextFactory.cs

27 lines
852 B
C#
Raw Normal View History

2018-11-23 02:22:05 -05:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace PoweredSoft.Data.Core
{
public interface IDbContextFactory
{
IQueryable<T> GetQueryable<T>()
where T : class;
IQueryable GetQueryable(Type type);
void Add(object entity);
void Remove(object entity);
int SaveChanges();
Task<int> SaveChangesAsync();
Task<T> FirstOrDefaultAsync<T>(IQueryable<T> queryable, CancellationToken cancellationToken);
Task<T> FirstOrDefaultAsync<T>(IQueryable<T> queryable, Expression<Func<T, bool>> predicate, CancellationToken cancellationToken);
Task<List<T>> ToListAsync<T>(IQueryable<T> queryable, CancellationToken cancellationToken);
}
}