public static void Register(HttpConfiguration config) { // Web API configuration and services var httpControllerRouteHandler = typeof(System.Web.Http.WebHost.HttpControllerRouteHandler).GetField("_instance", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); // To support Session in WebAPI if (httpControllerRouteHandler != null) { httpControllerRouteHandler.SetValue(null, new Lazy <System.Web.Http.WebHost.HttpControllerRouteHandler>(() => new SessionHttpControllerRouteHandler(), true)); } // Web API routes config.MapHttpAttributeRoutes(new WebApiCustomDirectRouteProvider()); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); // Register you exportes here // to make export works EasyQueryManager.RegisterExporter("csv", new CsvDataExporter()); EasyQueryManager.RegisterExporter("excel", new ExcelDataExporter()); EasyQueryManager.RegisterExporter("pdf", new PdfDataExporter()); // Allows to use DbConnectionModelLoader EasyQueryManagerSql.RegisterDbGate <Korzh.EasyQuery.DbGates.SqlServerGate>(); }
public static void Register(HttpConfiguration config) { //EasyQuery license keys Korzh.EasyQuery.AspNet.License.Key = "ZNQbiled5JoJMwzArFmSSQGSP5J77Y"; Korzh.EasyQuery.AspNet.JSLicense.Key = "voC5XVNcovrofRwXkHNKEABNJ4VH40"; // Web API configuration and services var httpControllerRouteHandler = typeof(System.Web.Http.WebHost.HttpControllerRouteHandler).GetField("_instance", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic); // To support Session in WebAPI if (httpControllerRouteHandler != null) { httpControllerRouteHandler.SetValue(null, new Lazy <System.Web.Http.WebHost.HttpControllerRouteHandler>(() => new SessionHttpControllerRouteHandler(), true)); } // Web API routes config.MapHttpAttributeRoutes(new WebApiCustomDirectRouteProvider()); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); // Register you exportes here // to make export works EasyQueryManager.RegisterExporter("csv", new CsvDataExporter()); EasyQueryManager.RegisterExporter("excel-html", new ExcelHtmlDataExporter()); }
public bool Tune(EasyQueryManager manager) { //An example of how you can add an extra condtion before query execution //var userId = (string)HttpContext.Current.Session["UserId"]; //manager.Query.ExtraConditions.AddSimpleCondition("Users.Id", "Equal", userId); return(true); }
public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(new WebApiCustomDirectRouteProvider()); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); // Register you exportes here // to make export works EasyQueryManager.RegisterExporter("csv", new CsvDataExporter()); EasyQueryManager.RegisterExporter("excel-html", new ExcelHtmlDataExporter()); // Uncomment this line to enable model loading from DbConnection // EasyQueryManagerSql.RegisterDbGate<Korzh.EasyQuery.DbGates.SqlClientGate>(); }