IDbContext.cs 893 B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data.Entity;
  4. using System.Data.Entity.Infrastructure;
  5. using System.Data.Entity.Validation;
  6. using System.Linq;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. using System.Web;
  10. namespace Central.Control.WebApi.EFDbContext
  11. {
  12. public interface IDbContext
  13. {
  14. DbEntityEntry Entry(Object entity);
  15. IEnumerable<DbEntityValidationResult> GetValidationErrors();
  16. Int32 SaveChanges();
  17. Task<Int32> SaveChangesAsync();
  18. Task<Int32> SaveChangesAsync(CancellationToken cancellationToken);
  19. DbSet Set(Type entityType);
  20. DbSet<TEntity> Set<TEntity>() where TEntity : class;
  21. /// <summary>
  22. /// 删除
  23. /// </summary>
  24. /// <typeparam name="T"></typeparam>
  25. /// <param name="id"></param>
  26. void Delete<T>(string id) where T : class;
  27. }
  28. }