Add Report Designer Feature
This commit is contained in:
parent
e8098ff43f
commit
aed9fb5051
7 changed files with 165 additions and 45 deletions
|
|
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.AspNetCore.Mvc.Versioning;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Serilog;
|
||||
|
|
@ -15,6 +16,9 @@ using Serilog.Exceptions;
|
|||
using Serilog.Sinks.Elasticsearch;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Telerik.Reporting.Cache.File;
|
||||
using Telerik.Reporting.Services;
|
||||
using Telerik.WebReportDesigner.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
{
|
||||
|
|
@ -92,6 +96,25 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
|
||||
// For Telerik Report Designer
|
||||
builder.Services.TryAddSingleton<IReportServiceConfiguration>(sp =>
|
||||
new ReportServiceConfiguration
|
||||
{
|
||||
ReportingEngineConfiguration = ResolveSpecificReportingConfiguration(sp.GetService<IWebHostEnvironment>()),
|
||||
HostAppId = "ReportingCoreApp",
|
||||
Storage = new FileStorage(),
|
||||
ReportSourceResolver = new TypeReportSourceResolver().AddFallbackResolver
|
||||
(new UriReportSourceResolver(Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports")))
|
||||
});
|
||||
builder.Services.TryAddSingleton<IReportDesignerServiceConfiguration>(sp => new ReportDesignerServiceConfiguration
|
||||
{
|
||||
DefinitionStorage = new FileDefinitionStorage(Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports"), new[] { "Resources", "Shared Data Sources" }),
|
||||
ResourceStorage = new ResourceStorage(Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports", "Resources")),
|
||||
SharedDataSourceStorage = new FileSharedDataSourceStorage(Path.Combine(sp.GetService<IWebHostEnvironment>().ContentRootPath, "Reports", "Shared Data Sources")),
|
||||
SettingsStorage = new FileSettingsStorage(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Telerik Reporting"))
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
var app = builder.Build();
|
||||
|
|
@ -113,7 +136,7 @@ var app = builder.Build();
|
|||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
|
@ -131,6 +154,14 @@ var app = builder.Build();
|
|||
app.Run();
|
||||
}
|
||||
|
||||
static IConfiguration ResolveSpecificReportingConfiguration(IWebHostEnvironment environment)
|
||||
{
|
||||
var reportingConfigFileName = Path.Combine(environment.ContentRootPath, "appsettings.json");
|
||||
return new ConfigurationBuilder()
|
||||
.AddJsonFile(reportingConfigFileName, true)
|
||||
.Build();
|
||||
}
|
||||
|
||||
void ConfigureLogs()
|
||||
{
|
||||
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue