protected override void ConfigureEasyQueryOptions(EasyQueryOptions options)
        {
            options.UseManager <EasyQueryManagerSql>();
            options.DefaultModelId   = "NWindSQL";
            options.BuildQueryOnSync = true;

            ConnectionStringSettings connectionSettings = ConfigurationManager.ConnectionStrings["DefaultConnection"];

            if (connectionSettings == null || string.IsNullOrEmpty(connectionSettings.ConnectionString))
            {
                throw new Exception("Fatal error: missing connecting string in web.config file");
            }

            options.UseDbConnection <SqlConnection>(connectionSettings.ConnectionString);

            var path = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data");

            options.UseModelLoader((_) => new FileModelLoader(path));
            options.UseQueryStore((_) => new FileQueryStore(path));

            // Uncomment this line if you want to load model directly from connection
            // Do not forget to uncomment SqlClientGate registration in WebApiConfig.cs file
            //options.UseDbConnectionModelLoader(config => {
            //    // Ignores Asp.Net Identity tables
            //    config.AddTableFilter((table) => !table.Name.StartsWith("Asp")
            //                                  && table.Name != "IdentityUsers"
            //                                  && table.Name != "__MigrationHistory");

            //    // Ignores Reports table
            //    config.AddTableFilter((table) => table.Name != "Reports");
            //});

            options.UsePaging(30);
        }
        protected override void ConfigureEasyQueryOptions(EasyQueryOptions options)
        {
            options.UseManager <EasyQueryManagerSql>();
            options.DefaultModelId   = "NWindSQL";
            options.BuildQueryOnSync = true;

            var connectionString = ConfigurationManagerWrapper.GetConnectionString("DefaultConncetion");

            options.UseDbConnection <SqlConnection>(connectionString);

            var path = System.Web.Hosting.HostingEnvironment.MapPath("~/App_Data");

            options.UseModelLoader((_) => new FileModelLoader(path));
            options.UseQueryStore((_) => new FileQueryStore(path));

            options.AddPreExecuteTuner(new SessionPreExecuteTuner());
        }
        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));
        }
Exemplo n.º 4
0
        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
            });
        }