using System.Web;
using Telerik.Reporting.Cache.Interfaces;
using Telerik.Reporting.Services.Engine;
using Telerik.Reporting.Services.WebApi;
using System.Linq;
using Telerik.Reporting.Services;
using Telerik.Reporting.Cache.File;
using System.IO;
namespace WebApplication1.Controllers
{
public class ReportsController : ReportsControllerBase
{
static ReportServiceConfiguration preservedConfiguration;
static IReportServiceConfiguration PreservedConfiguration
{
get
{
if (null == preservedConfiguration)
{
preservedConfiguration = new ReportServiceConfiguration
{
HostAppId = "WebApplication1",
Storage = new FileStorage(),
ReportResolver = CreateResolver(),
CachedReportTimeout = 0,
ClientSessionTimeout = 0,
};
}
return preservedConfiguration;
}
}
public ReportsController()
{
this.ReportServiceConfiguration = PreservedConfiguration;
}
static IReportResolver CreateResolver()
{
var reportsPath = HttpContext.Current.Server.MapPath("~/Reports");
return new ReportFileResolver(reportsPath)
.AddFallbackResolver(new ReportTypeResolver());
}
//protected override ICache CreateCache()
//{
// return Telerik.Reporting.Services.Engine.CacheFactory.CreateFileCache();
//}
}
}