protected override void ConfigureEasyQueryOptions(EasyQueryOptions options) { options.UseManager <EasyQueryManagerSql>(); options.DefaultModelId = "nwind"; options.BuildQueryOnSync = true; options.SaveQueryOnSync = false; options.UseDbContext(ApplicationDbContext.Create()); // If you want to load model directly from DB metadata // remove (or comment) options.UseDbContext(...) call and uncomment the next 3 lines of code //options.ConnectionString = // ConfigurationManager.ConnectionStrings["DefaultConnection"]?.ToString(); //options.UseDbConnection<SqlConnection>(); //options.UseDbConnectionModelLoader(); var path = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data"); options.UseQueryStore((_) => new FileQueryStore(path)); }
protected override void ConfigureEasyQueryOptions(EasyQueryOptions options) { //use EasyQuery manager that generates SQL queries options.UseManager<EasyQueryManagerSql>(); //options.DefaultModelId = "adhoc-reporting"; options.StoreModelInCache = true; //it is required to register caching service, when StoreInCache is turned on options.UseCaching((_) => new EqSessionCachingService()); //allow save query on sync for users with eq-manager role options.SaveQueryOnSync = User.IsInRole("eq-manager"); options.SaveNewQuery = true; var dbContext = ApplicationDbContext.Create(); options.UseDbContext(dbContext, config => { // Ignore identity tables config.AddFilter((entityMap) => { var entType = entityMap.Type; return !(entType.IsInheritedFromGeneric(typeof(IdentityUser<,,,>)) || entType.IsInheritedFromGeneric(typeof(IdentityUserClaim<>)) || entType.IsInheritedFromGeneric(typeof(IdentityUserRole<>)) || entType.IsInheritedFromGeneric(typeof(IdentityUserLogin<>)) || entType.IsInheritedFromGeneric(typeof(IdentityRole<,>))); }); // Ignore reports table config.AddFilter((entityMap) => { var entType = entityMap.Type; return entType != typeof(Report); }); }); options.UseQueryStore((_) => new ReportStore(dbContext, User)); options.UsePaging(30); }
protected override void ConfigureEasyQueryOptions(EasyQueryOptions options) { options.UseManager <EasyQueryManagerSql>(); options.DefaultModelId = "nwind"; options.BuildQueryOnSync = true; options.UseDbContext(ApplicationDbContext.Create()); // Uncomment the following 3 lines if you want to load model directly from the DB's meta-data // (it's better to remove UseDbContext(..) call abouve in this case) //options.ConnectionString = "Your connection string"; //options.UseDbConnection<SqlConnection>(); //options.UseDbConnectionModelLoader(); var path = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data"); options.UseQueryStore((_) => new FileQueryStore(path)); options.AddPreFetchTuner(manager => { //any code you would like to execute before the data is retrieved from the DB }); }