using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace CloudBuilder.Core.DatabaseAccessor.Entity
{
///
/// 定义实体仓储模型的数据标准操作
///
/// 实体类型
/// 主键类型
public interface IRepository
where TEntity : class
{
///
/// 实体集合
///
DbSet Entities { get; }
///
/// 不跟踪的(脱轨)实体
///
IQueryable DetachedEntities { get; }
///
/// 服务提供器
///
IServiceProvider ServiceProvider { get; }
///
/// 事务
///
IUnitOfWork UnitOfWork { get; set; }
DbContext GetDbContext();
K GetRepository();
///
/// 动态改变主数据库
///
void ChangeMasterDatabase();
///
/// 动态改变主数据库
///
void ChangeSecondaryDatabase();
#region FromSqlRaw
IQueryable FromSql(string sql, params object[] parameters);
IQueryable FromSqlWhere(TEntity t, string where, params object[] parameters);
TEntity[] FindBySql(string sql, params object[] parameters);
TEntity[] FindBySqlWhere(TEntity t, string where, params object[] parameters);
void PackSqlParameter(List