ModelContext.cs 576 B

1234567891011121314151617181920212223
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. namespace SqlSugar
  7. {
  8. public class ModelContext
  9. {
  10. [SugarColumn(IsIgnore = true)]
  11. [JsonIgnore]
  12. public SqlSugarProvider Context { get; set; }
  13. public ISugarQueryable<T> CreateMapping<T>() where T : class, new()
  14. {
  15. Check.ArgumentNullException(Context, "Please use Sqlugar.ModelContext");
  16. using (Context)
  17. {
  18. return Context.Queryable<T>();
  19. }
  20. }
  21. }
  22. }